From 145d7bf80a4c433e45cbf5da4d3124b27e183764 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 29 Apr 2022 14:28:35 +0200 Subject: [PATCH] [Darwin] Remove auto generated tests (#17843) --- .../tests/CHIPTestClustersObjc-src.zapt | 2 +- .../tests/partials/test_cluster.zapt | 6 +- .../templates/tests/templates.json | 1 - scripts/tools/zap_regen_all.py | 7 +- .../Framework/CHIP.xcodeproj/project.pbxproj | 8 - .../Framework/CHIP/templates/templates.json | 10 - .../templates/tests/CHIPClustersTests.zapt | 237 - .../Framework/CHIP/templates/tests/helper.js | 35 - .../tests/partials/check_test_value.zapt | 53 - .../tests/partials/defined_value.zapt | 7 - .../tests/partials/test_cluster.zapt | 246 - .../templates/tests/partials/test_value.zapt | 43 - .../CHIP/templates/tests/templates.json | 45 - .../Framework/CHIP/templates/tests/tests.js | 313 - .../CHIP/zap-generated/CHIPTestClustersObjc.h | 1304 - .../zap-generated/CHIPTestClustersObjc.mm | 17157 ------ .../Framework/CHIPTests/CHIPClustersTests.m | 48493 ---------------- .../cluster/CHIPTestClustersObjc.mm | 2 +- .../zap-generated/test/Commands.h | 38 +- 19 files changed, 25 insertions(+), 67982 deletions(-) delete mode 100644 src/darwin/Framework/CHIP/templates/tests/CHIPClustersTests.zapt delete mode 100644 src/darwin/Framework/CHIP/templates/tests/helper.js delete mode 100644 src/darwin/Framework/CHIP/templates/tests/partials/check_test_value.zapt delete mode 100644 src/darwin/Framework/CHIP/templates/tests/partials/defined_value.zapt delete mode 100644 src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt delete mode 100644 src/darwin/Framework/CHIP/templates/tests/partials/test_value.zapt delete mode 100644 src/darwin/Framework/CHIP/templates/tests/templates.json delete mode 100644 src/darwin/Framework/CHIP/templates/tests/tests.js delete mode 100644 src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h delete mode 100644 src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm diff --git a/examples/chip-tool-darwin/templates/tests/CHIPTestClustersObjc-src.zapt b/examples/chip-tool-darwin/templates/tests/CHIPTestClustersObjc-src.zapt index a535be1a73dfd3..6ea0650e10aba2 100644 --- a/examples/chip-tool-darwin/templates/tests/CHIPTestClustersObjc-src.zapt +++ b/examples/chip-tool-darwin/templates/tests/CHIPTestClustersObjc-src.zapt @@ -9,7 +9,7 @@ #import "CHIPDevice_Internal.h" #import "zap-generated/tests/CHIPClustersTest.h" -#import "zap-generated/CHIPTestClustersObjc.h" +#import "zap-generated/cluster/CHIPTestClustersObjc.h" #include #include diff --git a/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt b/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt index fe95b6f59304c2..55ffd02d3c2eb0 100644 --- a/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt @@ -82,7 +82,7 @@ class {{filename}}: public TestCommandBridge {{#chip_tests_items}} {{#if async}} - bool testSendCluster{{parent.filename}}_{{asTestIndex index}}_{{asUpperCamelCase command}}_Fulfilled = false; + bool testSendCluster{{parent.filename}}_{{index}}_{{asUpperCamelCase command}}_Fulfilled = false; {{/if}} {{#chip_tests_item_responses}} {{#chip_tests_item_response_parameters}} @@ -140,7 +140,7 @@ class {{filename}}: public TestCommandBridge maxInterval:[NSNumber numberWithUnsignedInt:maxIntervalArgument] params:params subscriptionEstablished:^{ - VerifyOrReturn(testSendCluster{{parent.filename}}_{{asTestIndex waitForReport.index}}_{{asUpperCamelCase waitForReport.command}}_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + VerifyOrReturn(testSendCluster{{parent.filename}}_{{waitForReport.index}}_{{asUpperCamelCase waitForReport.command}}_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); NextTest(); } reportHandler:^({{asObjectiveCClass attributeObject.type cluster forceList=attributeObject.isArray}} * _Nullable value, NSError * _Nullable err) { @@ -235,7 +235,7 @@ class {{filename}}: public TestCommandBridge {{#unless async}} NextTest(); {{else}} - testSendCluster{{parent.filename}}_{{asTestIndex ../index}}_{{asUpperCamelCase command}}_Fulfilled = true; + testSendCluster{{parent.filename}}_{{../index}}_{{asUpperCamelCase command}}_Fulfilled = true; {{/unless}} {{else}} {{! We're a subscription }} diff --git a/examples/chip-tool-darwin/templates/tests/templates.json b/examples/chip-tool-darwin/templates/tests/templates.json index f01e767b43121f..064fab84e08b67 100644 --- a/examples/chip-tool-darwin/templates/tests/templates.json +++ b/examples/chip-tool-darwin/templates/tests/templates.json @@ -9,7 +9,6 @@ "../../../../src/app/zap-templates/templates/chip/helper.js", "../../../../src/app/zap-templates/common/ClusterTestGeneration.js", "../../../../src/darwin/Framework/CHIP/templates/helper.js", - "../../../../src/darwin/Framework/CHIP/templates/tests/helper.js", "../helper.js", "tests.js" ], diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index b439df4f359038..7a876814dfce53 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -80,7 +80,7 @@ def setupArgumentsParser(): description='Generate content from ZAP files') parser.add_argument('--type', default='all', choices=['all', 'tests'], help='Choose which content type to generate (default: all)') - parser.add_argument('--tests', default='all', choices=['all', 'chip-tool', 'chip-tool-darwin', 'darwin', 'app1', 'app2'], + parser.add_argument('--tests', default='all', choices=['all', 'chip-tool', 'chip-tool-darwin', 'app1', 'app2'], help='When generating tests only target, Choose which tests to generate (default: all)') parser.add_argument('--dry-run', default=False, action='store_true', help="Don't do any generationl just log what targets would be generated (default: False)") @@ -145,11 +145,6 @@ def getTestsTemplatesTargets(test_target): 'zap': 'src/controller/data_model/controller-clusters.zap', 'template': 'examples/chip-tool-darwin/templates/tests/templates.json', 'output_dir': 'zzz_generated/chip-tool-darwin/zap-generated' - }, - 'darwin': { - 'zap': 'src/controller/data_model/controller-clusters.zap', - 'template': 'src/darwin/Framework/CHIP/templates/tests/templates.json', - 'output_dir': None } } diff --git a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj index 3b397fba31441e..fb9b6a2a6d63e3 100644 --- a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj @@ -7,8 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 1E16A90226B98AB700683C53 /* CHIPTestClustersObjc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1E16A8FA26B9835700683C53 /* CHIPTestClustersObjc.mm */; }; - 1E16A90326B98AF100683C53 /* CHIPTestClustersObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E16A8F926B9835600683C53 /* CHIPTestClustersObjc.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1E85730C265519AE0050A4D9 /* callback-stub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E857307265519AE0050A4D9 /* callback-stub.cpp */; }; 1EB41B7B263C4CC60048E4C1 /* CHIPClustersTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EB41B7A263C4CC60048E4C1 /* CHIPClustersTests.m */; }; 1EC3238D271999E2002A8BF0 /* cluster-objects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EC3238C271999E2002A8BF0 /* cluster-objects.cpp */; }; @@ -112,8 +110,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1E16A8F926B9835600683C53 /* CHIPTestClustersObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CHIPTestClustersObjc.h; path = "zap-generated/CHIPTestClustersObjc.h"; sourceTree = ""; }; - 1E16A8FA26B9835700683C53 /* CHIPTestClustersObjc.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CHIPTestClustersObjc.mm; path = "zap-generated/CHIPTestClustersObjc.mm"; sourceTree = ""; }; 1E857307265519AE0050A4D9 /* callback-stub.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "callback-stub.cpp"; path = "../../../../zzz_generated/controller-clusters/zap-generated/callback-stub.cpp"; sourceTree = ""; }; 1EB41B7A263C4CC60048E4C1 /* CHIPClustersTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CHIPClustersTests.m; sourceTree = ""; }; 1EC3238C271999E2002A8BF0 /* cluster-objects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "cluster-objects.cpp"; path = "../../../../zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp"; sourceTree = ""; }; @@ -250,8 +246,6 @@ 51B22C212740CB1D008D5055 /* CHIPCommandPayloadsObjc.h */, 51B22C1D2740CB0A008D5055 /* CHIPStructsObjc.h */, 1EC3238C271999E2002A8BF0 /* cluster-objects.cpp */, - 1E16A8F926B9835600683C53 /* CHIPTestClustersObjc.h */, - 1E16A8FA26B9835700683C53 /* CHIPTestClustersObjc.mm */, 1ED276DF26C57CF000547A89 /* CHIPCallbackBridge.mm */, 1E857307265519AE0050A4D9 /* callback-stub.cpp */, 1EC4CE6325CC276600D7304F /* CHIPClustersObjc.h */, @@ -394,7 +388,6 @@ 51B22C1E2740CB0A008D5055 /* CHIPStructsObjc.h in Headers */, 2CB7163B252E8A7B0026E2BB /* CHIPDevicePairingDelegateBridge.h in Headers */, 5ACDDD7A27CD129700EFD68A /* CHIPAttributeCacheContainer.h in Headers */, - 1E16A90326B98AF100683C53 /* CHIPTestClustersObjc.h in Headers */, 5A6FEC9227B5669C00F25F42 /* CHIPDeviceControllerOverXPC.h in Headers */, 2C1B027B2641DB4E00780EF1 /* CHIPOperationalCredentialsDelegate.h in Headers */, 99D466E12798936D0089A18F /* CHIPCommissioningParameters.h in Headers */, @@ -561,7 +554,6 @@ 997DED162695343400975E97 /* CHIPThreadOperationalDataset.mm in Sources */, 27A53C1827FBC6920053F131 /* CHIPAttestationTrustStoreBridge.mm in Sources */, 998F287126D56940001846C6 /* CHIPP256KeypairBridge.mm in Sources */, - 1E16A90226B98AB700683C53 /* CHIPTestClustersObjc.mm in Sources */, 5136661428067D550025EDAE /* MatterControllerFactory.mm in Sources */, 51B22C2A2740CB47008D5055 /* CHIPCommandPayloadsObjc.mm in Sources */, 2C5EEEF7268A85C400CAE3D3 /* CHIPDeviceConnectionBridge.mm in Sources */, diff --git a/src/darwin/Framework/CHIP/templates/templates.json b/src/darwin/Framework/CHIP/templates/templates.json index 88c738ce8d2a19..cfd25795167387 100644 --- a/src/darwin/Framework/CHIP/templates/templates.json +++ b/src/darwin/Framework/CHIP/templates/templates.json @@ -87,16 +87,6 @@ "name": "Objc reflections of CHIP command payloads header", "output": "src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm" }, - { - "path": "../../../../../examples/chip-tool-darwin/templates/tests/CHIPTestClustersObjc.zapt", - "name": "Test Objc API Header", - "output": "src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h" - }, - { - "path": "../../../../../examples/chip-tool-darwin/templates/tests/CHIPTestClustersObjc-src.zapt", - "name": "Test Objc API", - "output": "src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm" - }, { "path": "CHIPAttributeTLVValueDecoder-src.zapt", "name": "Decode TLV attribute values into Objc objects", diff --git a/src/darwin/Framework/CHIP/templates/tests/CHIPClustersTests.zapt b/src/darwin/Framework/CHIP/templates/tests/CHIPClustersTests.zapt deleted file mode 100644 index 0423c35f3aff0b..00000000000000 --- a/src/darwin/Framework/CHIP/templates/tests/CHIPClustersTests.zapt +++ /dev/null @@ -1,237 +0,0 @@ -// -// CHIPClustersTests.m -// CHIPClustersTests -{{>header}} - -// module headers -#import -#import - -#import "CHIPErrorTestUtils.h" -#import "CHIPTestStorage.h" - -#import - -#import // For INFINITY - -// system dependencies -#import - -const uint16_t kPairingTimeoutInSeconds = 10; -const uint16_t kAddressResolveTimeoutInSeconds = 10; -const uint16_t kCASESetupTimeoutInSeconds = 30; -const uint16_t kTimeoutInSeconds = 20; -const uint64_t nodeId = 0x12344321; -const uint16_t kDiscriminator = 3840; -const uint32_t kSetupPINCode = 20202021; -const uint16_t kRemotePort = 5540; -const uint16_t kLocalPort = 5541; -NSString * kAddress = @"::1"; -static uint16_t kTestVendorId = 0xFFF1u; - -// This test suite reuses a device object to speed up the test process for CI. -// The following global variable holds the reference to the device object. -static CHIPDevice * mConnectedDevice; - -// Singleton controller we use. -static CHIPDeviceController * sController = nil; - -// Test Util APIs -void WaitForMs(XCTestExpectation * expectation, dispatch_queue_t queue, unsigned int ms) -{ - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, ms * NSEC_PER_MSEC), queue, ^{ - [expectation fulfill]; - }); -} - -void Log(XCTestExpectation * expectation, dispatch_queue_t queue, NSString * message){ - NSLog(@"%@", message); - [expectation fulfill]; -} - -// Stub for User Prompts for XCTests to run. -void UserPrompt(XCTestExpectation * expectation, dispatch_queue_t queue, NSString * message) { - [expectation fulfill]; -} - -// Stub for reboot target device. -void Reboot(XCTestExpectation * expectation, dispatch_queue_t queue, uint16_t discriminator) -{ - [expectation fulfill]; -} - -void WaitForCommissionee(XCTestExpectation * expectation, dispatch_queue_t queue, uint64_t deviceId) -{ - CHIPDeviceController * controller = sController; - XCTAssertNotNil(controller); - - [controller getConnectedDevice:deviceId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [expectation fulfill]; - mConnectedDevice = device; - }]; -} - -CHIPDevice * GetConnectedDevice(void) -{ - XCTAssertNotNil(mConnectedDevice); - return mConnectedDevice; -} - -@interface CHIPToolPairingDelegate : NSObject -@property (nonatomic, strong) XCTestExpectation * expectation; -@end - -@implementation CHIPToolPairingDelegate -- (id)initWithExpectation:(XCTestExpectation *)expectation -{ - self = [super init]; - if (self) { - _expectation = expectation; - } - return self; -} - -- (void)onPairingComplete:(NSError *)error -{ - XCTAssertEqual(error.code, 0); - // Keep waiting for onCommissioningComplete -} - -- (void)onCommissioningComplete:(NSError *)error -{ - XCTAssertEqual(error.code, 0); - [_expectation fulfill]; - _expectation = nil; -} - -- (void)onAddressUpdated:(NSError *)error -{ - XCTAssertEqual(error.code, 0); - [_expectation fulfill]; - _expectation = nil; -} -@end - -@interface CHIPClustersTests : XCTestCase -@end - -@implementation CHIPClustersTests - -- (void)setUp { - [super setUp]; - [self setContinueAfterFailure:NO]; -} - -- (void)testInitStack -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Pairing Complete"]; - - __auto_type * factory = [MatterControllerFactory sharedInstance]; - XCTAssertNotNil(factory); - - __auto_type * storage = [[CHIPTestStorage alloc] init]; - __auto_type * factoryParams = [[MatterControllerFactoryParams alloc] initWithStorage:storage]; - factoryParams.port = @(kLocalPort); - - BOOL ok = [factory startup:factoryParams]; - XCTAssertTrue(ok); - - __auto_type * params = [[CHIPDeviceControllerStartupParams alloc] initWithKeypair:nil]; - params.vendorId = kTestVendorId; - params.fabricId = 1; - - // TODO: Once we have a non-nil keypair, use startControllerOnNewFabric. - CHIPDeviceController * controller = [factory startControllerOnExistingFabric:params]; - XCTAssertNotNil(controller); - - sController = controller; - - CHIPToolPairingDelegate * pairing = [[CHIPToolPairingDelegate alloc] initWithExpectation:expectation]; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.pairing", DISPATCH_QUEUE_SERIAL); - - [controller setPairingDelegate:pairing queue:callbackQueue]; - - NSError * error; - [controller pairDevice:nodeId - address:kAddress - port:kRemotePort - discriminator:kDiscriminator - setupPINCode:kSetupPINCode - error:&error]; - XCTAssertEqual(error.code, 0); - - [self waitForExpectationsWithTimeout:kPairingTimeoutInSeconds handler:nil]; - - __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; - [controller getConnectedDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [connectionExpectation fulfill]; - connectionExpectation = nil; - }]; - [self waitForExpectationsWithTimeout:kCASESetupTimeoutInSeconds handler:nil]; -} - -- (void)testShutdownStack -{ - CHIPDeviceController * controller = sController; - XCTAssertNotNil(controller); - - [controller shutdown]; - XCTAssertFalse([controller isRunning]); - - [[MatterControllerFactory sharedInstance] shutdown]; - XCTAssertFalse([[MatterControllerFactory sharedInstance] isRunning]); -} - -- (void)testReuseChipClusterObject -{ - CHIPDeviceController * controller = sController; - XCTAssertNotNil(controller); - - __block CHIPDevice * device; - __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; - [controller getConnectedDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable retrievedDevice, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [connectionExpectation fulfill]; - connectionExpectation = nil; - device = retrievedDevice; - }]; - [self waitForExpectationsWithTimeout:kCASESetupTimeoutInSeconds handler:nil]; - - XCTestExpectation * expectation = [self expectationWithDescription:@"ReuseCHIPClusterObjectFirstCall"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster testWithCompletionHandler:^(NSError * err) { - NSLog(@"ReuseCHIPClusterObject test Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; - - expectation = [self expectationWithDescription:@"ReuseCHIPClusterObjectSecondCall"]; - - // Reuse the CHIPCluster Object for multiple times. - - [cluster testWithCompletionHandler:^(NSError * err) { - NSLog(@"ReuseCHIPClusterObject test Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -{{>test_cluster tests=(getTests)}} - -@end diff --git a/src/darwin/Framework/CHIP/templates/tests/helper.js b/src/darwin/Framework/CHIP/templates/tests/helper.js deleted file mode 100644 index b188e85b9656b4..00000000000000 --- a/src/darwin/Framework/CHIP/templates/tests/helper.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * In order to run the tests into an expected order, an index is - * added to the generated test step. This is because tests using - * the XCTest framework are expected to be independent and should - * normally run as independent steps. But since the current code is - * dealing with a simulated accessory running into its own process - * for the whole duration of the tests, its state is not resetted - * between each steps which defeats XCTest expectation. - */ -function asTestIndex(index) -{ - return index.toString().padStart(6, 0); -} - -// -// Module exports -// -exports.asTestIndex = asTestIndex; diff --git a/src/darwin/Framework/CHIP/templates/tests/partials/check_test_value.zapt b/src/darwin/Framework/CHIP/templates/tests/partials/check_test_value.zapt deleted file mode 100644 index 0cfd749c0cb034..00000000000000 --- a/src/darwin/Framework/CHIP/templates/tests/partials/check_test_value.zapt +++ /dev/null @@ -1,53 +0,0 @@ -{{#if (chip_tests_config_has expected)}} - {{! Just replace the value's name with the actual value in the rest of the processing~}} - {{>check_test_value target=target expected=(chip_tests_config_get_default_value expected) cluster=cluster depth=depth}} -{{else if isOptional}} - {{! This just means we expect a non-nil value. Go ahead and check the value, - stripping the optionality off. }} - {{>check_test_value actual=actual expected=expected cluster=cluster isOptional=false}} -{{else if isNullable}} - {{#if (isLiteralNull expected)}} - XCTAssertTrue({{actual}} == nil); - {{else}} - {{#if (chip_tests_variables_has expected)}} - {{! Expected value is also a nullable. }} - if ({{expected}} == nil) { - XCTAssertTrue({{actual}} == nil); - } else { - {{/if}} - XCTAssertFalse({{actual}} == nil); - {{>check_test_value actual=actual expected=expected cluster=cluster isNullable=false}} - {{#if (chip_tests_variables_has expected)}} - } - {{/if}} - {{/if}} -{{else if isArray}} - {{ensureIsArray expected~}} - XCTAssertEqual([{{actual}} count], {{expected.length}}); - {{#each expected}} - {{>check_test_value actual=(concat ../actual "[" @index "]") expected=this cluster=../cluster isArray=false type=../type parent=../parent}} - {{/each}} -{{else}} - {{#if_is_struct type}} - {{! Iterate over the actual types in the struct, so we pick up the right - type/optionality/nullability information for them for our recursive - call. }} - {{#zcl_struct_items_by_struct_name type}} - {{#if (hasProperty ../expected label)}} - {{>check_test_value actual=(concat "((CHIP" (asUpperCamelCase ../cluster) "Cluster" (asUpperCamelCase ../type) " *)" ../actual ")." (asStructPropertyName label)) expected=(lookup ../expected label) cluster=../cluster}} - {{/if}} - {{/zcl_struct_items_by_struct_name}} - {{! Maybe we should add a check for properties in the expected object (other - than "global") that are not present in the struct ? }} - {{else}} - {{#if (chip_tests_variables_has expected)}} - XCTAssertEqualObjects({{actual}}, {{expected}}); - {{else if (isOctetString type)}} - XCTAssertTrue([{{actual}} isEqualToData:[[NSData alloc] initWithBytes:"{{octetStringEscapedForCLiteral expected}}" length:{{expected.length}}]]); - {{else if (isCharString type)}} - XCTAssertTrue([{{actual}} isEqualToString:@"{{expected}}"]); - {{else}} - XCTAssertEqual([{{actual}} {{asObjectiveCNumberType "" type true}}Value], {{asTypedLiteral expected type}}); - {{/if}} - {{/if_is_struct}} -{{/if}} diff --git a/src/darwin/Framework/CHIP/templates/tests/partials/defined_value.zapt b/src/darwin/Framework/CHIP/templates/tests/partials/defined_value.zapt deleted file mode 100644 index 0b4a2db4a98048..00000000000000 --- a/src/darwin/Framework/CHIP/templates/tests/partials/defined_value.zapt +++ /dev/null @@ -1,7 +0,0 @@ -{{! If the defined value is the name of a config variable, just - substitute the value of the variable instead. }} -{{#if (chip_tests_config_has definedValue)~}} - {{chip_tests_config_get_default_value definedValue}} -{{~else~}} - {{definedValue}} -{{~/if}} diff --git a/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt deleted file mode 100644 index c6b388389700ca..00000000000000 --- a/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt +++ /dev/null @@ -1,246 +0,0 @@ -{{#chip_tests tests useSynthesizeWaitForReport=true}} -{{#chip_tests_items}} -{{#if async}} -bool testSendCluster{{parent.filename}}_{{asTestIndex index}}_{{asUpperCamelCase command}}_Fulfilled = false; -{{/if}} -{{#chip_tests_item_responses}} -{{#chip_tests_item_response_parameters}} -{{#if saveAs}} -{{asObjectiveCType type ../cluster}} {{saveAs}}; -{{/if}} -{{/chip_tests_item_response_parameters}} -{{/chip_tests_item_responses}} - -{{~#*inline "subscribeDataCallback"}} -test_{{parent.filename}}_{{attribute}}_Reported -{{/inline}} -{{#if allocateSubscribeDataCallback}} -ResponseHandler {{> subscribeDataCallback}} = nil; -{{/if~}} - -- (void)testSendCluster{{parent.filename}}_{{asTestIndex index}}_{{asUpperCamelCase command}} -{ - {{#unless async}} - XCTestExpectation * expectation = [self expectationWithDescription:@"{{label}}"]; - {{/unless}} - -{{#if (isTestOnlyCluster cluster)}} - dispatch_queue_t queue = dispatch_get_main_queue(); - {{#if (isStrEqual command "UserPrompt")}} - {{! We only support the first arg, and our impl is a no-op anyway. }} - {{command}}(expectation, queue{{#chip_tests_item_parameters}}{{#first}}, {{#if (isString type)}}@"{{/if}}{{> defined_value}}{{#if (isString type)}}"{{/if}}{{/first}}{{/chip_tests_item_parameters}}); - {{else}} - {{command}}(expectation, queue{{#chip_tests_item_parameters}}, {{#if (isString type)}}@"{{/if}}{{> defined_value}}{{#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}}); - {{/if}} -{{else}} - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTest{{asUpperCamelCase cluster}} * cluster = [[CHIPTest{{asUpperCamelCase cluster}} alloc] initWithDevice:device endpoint:{{endpoint}} queue:queue]; - XCTAssertNotNil(cluster); - - {{#if isCommand}} - {{#if commandObject.arguments.length}} - __auto_type * params = [[CHIP{{asUpperCamelCase cluster}}Cluster{{asUpperCamelCase command}}Params alloc] init]; - {{/if}} - {{#chip_tests_item_parameters}} - {{>test_value target=(concat "params." (asStructPropertyName label)) definedValue=definedValue cluster=parent.cluster depth=0}} - {{/chip_tests_item_parameters}} - [cluster {{asLowerCamelCase command}}With - {{~#if commandObject.arguments.length~}} - Params:params completionHandler: - {{else~}} - CompletionHandler: - {{/if}} - {{#if commandObject.hasSpecificResponse}} - ^(CHIP{{asUpperCamelCase cluster}}Cluster{{asUpperCamelCase commandObject.responseName}}Params * _Nullable values, NSError * _Nullable err) { - {{else}} - ^(NSError * _Nullable err) { - {{/if}} - {{else if isSubscribeAttribute}} - {{#chip_tests_item_parameters}} - {{asObjectiveCBasicType type}} {{asLowerCamelCase name}}Argument = {{asTypedLiteral definedValue type}}; - {{/chip_tests_item_parameters}} - CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:{{fabricFiltered}}]; - [cluster subscribeAttribute{{asUpperCamelCase attribute}}WithMinInterval:@(minIntervalArgument) - maxInterval:@(maxIntervalArgument) - params:params - subscriptionEstablished:^{ - XCTAssertEqual(testSendCluster{{parent.filename}}_{{asTestIndex waitForReport.index}}_{{asUpperCamelCase waitForReport.command}}_Fulfilled, true); - [expectation fulfill]; - } - reportHandler:^({{asObjectiveCClass attributeObject.type cluster forceList=attributeObject.isArray}} * _Nullable value, NSError * _Nullable err) { - {{else if isWaitForReport}} - {{> subscribeDataCallback }} = ^({{asObjectiveCClass attributeObject.type cluster forceList=attributeObject.isArray}} * _Nullable value, NSError * _Nullable err) { - {{else if isReadAttribute}} - {{#if_is_fabric_scoped_struct attributeObject.type}} - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:{{fabricFiltered}}]; - [cluster readAttribute{{asUpperCamelCase attribute}}WithParams:params completionHandler: - {{else}} - [cluster readAttribute{{asUpperCamelCase attribute}}WithCompletionHandler: - {{/if_is_fabric_scoped_struct}} - ^({{asObjectiveCClass attributeObject.type cluster forceList=attributeObject.isArray}} * _Nullable value, NSError * _Nullable err) { - {{else if isWriteAttribute}} - {{#chip_tests_item_parameters}} - id {{asLowerCamelCase name}}Argument; - {{>test_value target=(concat (asLowerCamelCase name) "Argument") definedValue=definedValue cluster=parent.cluster depth=0}} - {{/chip_tests_item_parameters}} - [cluster writeAttribute{{asUpperCamelCase attribute}}WithValue:{{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument{{/chip_tests_item_parameters}} completionHandler:^(NSError * _Nullable err) { - {{/if}} - {{#chip_tests_item_responses}} - NSLog(@"{{../label}} Error: %@", err); - - {{#if optional}} - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - {{/if}} - - {{#if error}} - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], {{error}}); - [expectation fulfill]; - {{else}} - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - {{#unless isSubscribeAttribute}} - - {{#chip_tests_item_response_parameters}} - {{#*inline "actualValue"}} - {{#if parent.isAttribute}} - id actualValue = value; - {{else}} - id actualValue = values.{{asStructPropertyName name}}; - {{/if}} - {{/inline}} - {{#if hasExpectedValue}} - { - {{> actualValue}} - {{>check_test_value actual="actualValue" expected=expectedValue cluster=../cluster}} - } - {{/if}} - {{#if hasExpectedConstraints}} - {{#if (hasProperty expectedConstraints "minLength")}} - { - {{> actualValue}} - XCTAssertGreaterThanOrEqual([actualValue length], {{expectedConstraints.minLength}}); - } - {{/if}} - {{#if (hasProperty expectedConstraints "startsWith")}} - { - {{> actualValue}} - XCTAssertTrue([actualValue hasPrefix:@"{{expectedConstraints.startsWith}}"]); - } - {{/if}} - {{#if (hasProperty expectedConstraints "endsWith")}} - { - {{> actualValue}} - XCTAssertTrue([actualValue hasSuffix:@"{{expectedConstraints.endsWith}}"]); - } - {{/if}} - {{#if (hasProperty expectedConstraints "isLowerCase")}} - { - {{> actualValue}} - BOOL isLowerCase = [actualValue isEqualToString:[actualValue lowercaseString]]; - XCTAssert{{#if (isStrEqual "true" expectedConstraints.isLowerCase)}}True{{else}}False{{/if}}(isLowerCase); - } - {{/if}} - {{#if (hasProperty expectedConstraints "isUpperCase")}} - { - {{> actualValue}} - BOOL isUpperCase = [actualValue isEqualToString:[actualValue uppercaseString]]; - XCTAssert{{#if (isStrEqual "true" expectedConstraints.isUpperCase)}}True{{else}}False{{/if}}(isUpperCase); - } - {{/if}} - {{#if (hasProperty expectedConstraints "isHexString")}} - { - {{> actualValue}} - NSCharacterSet *chars = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789ABCDEF"] invertedSet]; - BOOL isHexString = (NSNotFound == [actualValue rangeOfCharacterFromSet:chars].location); - XCTAssert{{#if (isStrEqual "true" expectedConstraints.isHexString)}}True{{else}}False{{/if}}(isHexString); - } - {{/if}} - {{#if (hasProperty expectedConstraints "maxLength")}} - { - {{> actualValue}} - XCTAssertLessThanOrEqual([actualValue length], {{expectedConstraints.maxLength}}); - } - {{/if}} - {{#if (hasProperty expectedConstraints "minValue")}} - { - {{> actualValue}} - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue {{asObjectiveCNumberType "" type true}}Value], {{asTypedLiteral expectedConstraints.minValue type}}); - } - } - {{/if}} - {{#if (hasProperty expectedConstraints "maxValue")}} - { - {{> actualValue}} - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue {{asObjectiveCNumberType "" type true}}Value], {{asTypedLiteral expectedConstraints.maxValue type}}); - } - } - {{/if}} - {{#if (hasProperty expectedConstraints "notValue")}} - { - {{> actualValue}} - {{#if (isLiteralNull expectedConstraints.notValue)}} - XCTAssertFalse(actualValue == nil); - {{else}} - {{#if (chip_tests_variables_has expectedConstraints.notValue)}} - XCTAssertNotEqualObjects(actualValue, {{expectedConstraints.notValue}}); - {{else}} - if (actualValue != nil) { - {{#if (isString type)}} - XCTAssertNotEqualObjects(actualValue, {{expectedConstraints.notValue}}); - {{else}} - XCTAssertNotEqual([actualValue {{asObjectiveCNumberType "" type true}}Value], {{asTypedLiteral expectedConstraints.notValue type}}); - {{/if}} - } - {{/if}} - {{/if}} - } - {{/if}} - {{/if}} - {{#if saveAs}} - { - {{> actualValue}} - {{saveAs}} = actualValue; - } - {{/if}} - {{/chip_tests_item_response_parameters}} - - {{#unless async}} - [expectation fulfill]; - {{else}} - testSendCluster{{parent.filename}}_{{asTestIndex ../index}}_{{asUpperCamelCase command}}_Fulfilled = true; - {{/unless}} - {{else}} - {{! We're a subscription }} - if ({{> subscribeDataCallback}} != nil) { - ResponseHandler callback = {{> subscribeDataCallback}}; - {{> subscribeDataCallback}} = nil; - callback(value, err); - } - {{/unless}} - {{/if}} - {{/chip_tests_item_responses}} - }{{#unless isWaitForReport}}]{{/unless}}; - -{{/if}} - {{#unless async}} - {{#*inline "minCommandTimeout"~}} - {{#if (isTestOnlyCluster cluster)~}} - {{#if (isStrEqual command "WaitForMs")~}} - {{#chip_tests_item_parameters}}{{#if (isStrEqual name "ms")}}({{> defined_value}} / 1000) + {{/if}}{{/chip_tests_item_parameters}} - {{~/if}} - {{~/if}} - {{~/inline}} - [self waitForExpectationsWithTimeout:{{#if stepTimeoutSecs}}{{stepTimeoutSecs}}{{else}}{{> minCommandTimeout}}kTimeoutInSeconds{{/if}} handler:nil]; - {{/unless}} -} -{{/chip_tests_items}} - -{{/chip_tests}} - diff --git a/src/darwin/Framework/CHIP/templates/tests/partials/test_value.zapt b/src/darwin/Framework/CHIP/templates/tests/partials/test_value.zapt deleted file mode 100644 index 77438fd32fb7f3..00000000000000 --- a/src/darwin/Framework/CHIP/templates/tests/partials/test_value.zapt +++ /dev/null @@ -1,43 +0,0 @@ -{{#if (chip_tests_config_has definedValue)}} - {{! Just replace the value's name with the actual value in the rest of the processing~}} - {{>test_value target=target definedValue=(chip_tests_config_get_default_value definedValue) cluster=cluster depth=depth}} -{{else if isOptional}} - {{! Just go ahead and assign to the value, stripping the optionality bit off. }} - {{>test_value target=target definedValue=definedValue cluster=cluster isOptional=false depth=(incrementDepth depth)}} -{{else if isNullable}} - {{#if (isLiteralNull definedValue)}} - {{target}} = nil; - {{else}} - {{>test_value target=target definedValue=definedValue cluster=cluster isNullable=false depth=(incrementDepth depth)}} - {{/if}} -{{else if isArray}} - {{ensureIsArray definedValue~}} - { - NSMutableArray * temp_{{depth}} = [[NSMutableArray alloc] init]; - {{#each definedValue}} - {{>test_value target=(concat "temp_" ../depth "[" @index "]") definedValue=this cluster=../cluster depth=(incrementDepth ../depth) type=../type isArray=false parent=../parent}} - {{/each}} - {{target}} = temp_{{depth}}; - } -{{else}} - {{#if_is_struct type}} - {{target}} = [[CHIP{{asUpperCamelCase cluster}}Cluster{{asUpperCamelCase type}} alloc] init]; - {{#zcl_struct_items_by_struct_name type}} - {{#if_include_struct_item_value ../definedValue name}} - {{! target may be some place where we lost type information (e.g. an - id), so add explicit cast when trying to assign to our - properties. }} - {{>test_value target=(concat "((CHIP" (asUpperCamelCase ../cluster) "Cluster" (asUpperCamelCase ../type) " *)" ../target ")." (asStructPropertyName label)) definedValue=(lookup ../definedValue name) cluster=../cluster depth=(incrementDepth ../depth)}} - {{/if_include_struct_item_value}} - {{/zcl_struct_items_by_struct_name}} - - {{else if (chip_tests_variables_has definedValue)}} - {{target}} = [{{definedValue}} copy]; - {{else if (isCharString type)}} - {{target}} = @"{{definedValue}}"; - {{else if (isOctetString type)}} - {{target}} = [[NSData alloc] initWithBytes:"{{octetStringEscapedForCLiteral definedValue}}" length:{{definedValue.length}}]; - {{else}} - {{target}} = [NSNumber numberWith{{asObjectiveCNumberType definedValue type false}}:{{asTypedLiteral definedValue type}}]; - {{/if_is_struct}} -{{/if}} diff --git a/src/darwin/Framework/CHIP/templates/tests/templates.json b/src/darwin/Framework/CHIP/templates/tests/templates.json deleted file mode 100644 index b095c453edab58..00000000000000 --- a/src/darwin/Framework/CHIP/templates/tests/templates.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "Framework Tests templates", - "version": "chip-v1", - "helpers": [ - "../../../../../../src/app/zap-templates/partials/helper.js", - "../../../../../../src/app/zap-templates/common/ChipTypesHelper.js", - "../../../../../../src/app/zap-templates/common/StringHelper.js", - "../../../../../../src/app/zap-templates/templates/app/helper.js", - "../../../../../../src/app/zap-templates/templates/chip/helper.js", - "../../../../../../src/app/zap-templates/common/ClusterTestGeneration.js", - "../helper.js", - "helper.js", - "tests.js" - ], - "override": "../../../../../../src/app/zap-templates/common/override.js", - "partials": [ - { - "name": "header", - "path": "../../../../../../src/app/zap-templates/partials/header.zapt" - }, - { - "name": "test_cluster", - "path": "partials/test_cluster.zapt" - }, - { - "name": "test_value", - "path": "partials/test_value.zapt" - }, - { - "name": "check_test_value", - "path": "partials/check_test_value.zapt" - }, - { - "name": "defined_value", - "path": "partials/defined_value.zapt" - } - ], - "templates": [ - { - "path": "CHIPClustersTests.zapt", - "name": "Cluster Tests", - "output": "src/darwin/Framework/CHIPTests/CHIPClustersTests.m" - } - ] -} diff --git a/src/darwin/Framework/CHIP/templates/tests/tests.js b/src/darwin/Framework/CHIP/templates/tests/tests.js deleted file mode 100644 index 270878ced0ff93..00000000000000 --- a/src/darwin/Framework/CHIP/templates/tests/tests.js +++ /dev/null @@ -1,313 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function getManualTests() -{ - return []; -} - -function getTests() -{ - const AccessControl = [ - 'TestAccessControlCluster', - ]; - - const BinaryInput = [ - 'Test_TC_BI_1_1', - 'Test_TC_BI_2_1', - 'Test_TC_BI_2_2', - ]; - - const BooleanState = [ - 'Test_TC_BOOL_2_1', - ]; - - const BridgedActions = [ - 'Test_TC_BRAC_1_1', - ]; - - const ColorControl = [ - 'Test_TC_CC_2_1', - 'Test_TC_CC_3_1', - 'Test_TC_CC_3_2', - 'Test_TC_CC_3_3', - 'Test_TC_CC_4_1', - 'Test_TC_CC_4_2', - 'Test_TC_CC_4_3', - 'Test_TC_CC_4_4', - 'Test_TC_CC_5_1', - 'Test_TC_CC_5_2', - 'Test_TC_CC_5_3', - 'Test_TC_CC_6_1', - 'Test_TC_CC_6_2', - 'Test_TC_CC_6_3', - 'Test_TC_CC_7_1', - 'Test_TC_CC_7_2', - 'Test_TC_CC_7_3', - 'Test_TC_CC_7_4', - 'Test_TC_CC_8_1', - 'Test_TC_CC_9_1', - 'Test_TC_CC_9_2', - 'Test_TC_CC_9_3', - ]; - - const DeviceDiscovery = [ - 'Test_TC_DD_1_5', - 'Test_TC_DD_1_6', - 'Test_TC_DD_1_7', - 'Test_TC_DD_1_8', - 'Test_TC_DD_1_9', - ]; - - const DeviceManagement = [ - 'Test_TC_DM_1_1', - 'Test_TC_DM_3_1', - ]; - - const DoorLock = [ - 'Test_TC_DL_1_3', - ]; - - const ElectricalMeasurement = [ - 'Test_TC_EMR_1_1', - ]; - - const EthernetNetworkDiagnostics = [ - 'Test_TC_ETHDIAG_1_1', - 'Test_TC_ETHDIAG_2_1', - ]; - - const FlowMeasurement = [ - 'Test_TC_FLW_2_1', - 'Test_TC_FLW_2_2', - ]; - - const GeneralCommissioning = [ - 'Test_TC_GC_1_1', - ]; - - const Identify = [ - 'Test_TC_I_2_1', - 'Test_TC_I_2_3', - ]; - - const IlluminanceMeasurement = [ - 'Test_TC_ILL_2_1', - ]; - - const OccupancySensing = [ - 'Test_TC_OCC_2_1', - 'Test_TC_OCC_2_2', - ]; - - const LevelControl = [ - 'Test_TC_LVL_2_1', - 'Test_TC_LVL_2_2', - 'Test_TC_LVL_3_1', - 'Test_TC_LVL_4_1', - 'Test_TC_LVL_5_1', - 'Test_TC_LVL_6_1', - ]; - - const MediaControl = [ - 'Test_TC_MC_2_1', - 'Test_TC_MC_3_6', - 'Test_TC_MC_3_7', - 'Test_TC_MC_3_8', - 'Test_TC_MC_3_9', - 'Test_TC_MC_3_10', - 'Test_TC_MC_3_11', - 'Test_TC_MC_5_1', - 'Test_TC_MC_5_2', - 'Test_TC_MC_5_3', - 'Test_TC_MC_6_1', - 'Test_TC_MC_6_2', - 'Test_TC_MC_6_3', - 'Test_TC_MC_6_4', - 'Test_TC_MC_7_1', - '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 = [ - 'Test_TC_OO_2_1', 'Test_TC_OO_2_2', 'Test_TC_OO_2_3', - // 'Test_TC_OO_2_4', Disable this Test for now as Darwin does not support reboot commands currently - ]; - - const PowerSource = [ - 'Test_TC_PS_2_1', - ]; - - const PressureMeasurement = [ - 'Test_TC_PRS_2_1', - ]; - - const PumpConfigurationControl = [ - 'Test_TC_PCC_1_1', - 'Test_TC_PCC_2_1', - 'Test_TC_PCC_2_2', - 'Test_TC_PCC_2_3', - 'Test_TC_PCC_2_4', - ]; - - const PowerSourceConfiguration = [ - 'Test_TC_PSCFG_1_1', - ]; - - const RelativeHumidityMeasurement = [ - 'Test_TC_RH_2_2', - ]; - - const Switch = [ - 'Test_TC_SWTCH_2_1', - 'Test_TC_SWTCH_2_2', - ]; - - const TemperatureMeasurement = [ - 'Test_TC_TM_2_1', - 'Test_TC_TM_2_2', - ]; - - const Thermostat = [ - 'Test_TC_TSTAT_1_1', - 'Test_TC_TSTAT_2_1', - 'Test_TC_TSTAT_2_2', - ]; - - const ThermostatUserConfiguration = [ - 'Test_TC_TSUIC_2_1', - 'Test_TC_TSUIC_2_2', - ]; - - const ThreadNetworkDiagnostics = [ - 'Test_TC_DIAG_TH_NW_1_1', - 'Test_TC_DIAG_TH_NW_1_2', - ]; - - const UserLabel = [ - 'Test_TC_LC_1_2', - ]; - - const WiFiNetworkDiagnostics = [ - 'Test_TC_WIFIDIAG_1_1', - 'Test_TC_WIFIDIAG_3_1', - ]; - - const WindowCovering = [ - // WindowCovering is make uses of multiples "subscribeAttribute", but it triggers - // some failures on darwin supposely because the ReadClient stays open for the - // whole duration of the tests and that goes past some internal limits. - // Because of this, some of the tests are disabled on darwin. - 'Test_TC_WNCV_1_1', - 'Test_TC_WNCV_2_1', - 'Test_TC_WNCV_2_2', - 'Test_TC_WNCV_2_3', - 'Test_TC_WNCV_2_4', - 'Test_TC_WNCV_2_5', - //'Test_TC_WNCV_3_1', - //'Test_TC_WNCV_3_2', - //'Test_TC_WNCV_3_3', - 'Test_TC_WNCV_3_4', - 'Test_TC_WNCV_3_5', - 'Test_TC_WNCV_4_1', - 'Test_TC_WNCV_4_2', - 'Test_TC_WNCV_4_3', - 'Test_TC_WNCV_4_4', - ]; - - const Others = [ - 'TestCluster', - 'TestSaveAs', - 'TestConstraints', - 'TestDelayCommands', - 'TestDescriptorCluster', - // TestBasicInformation needs support for Reboot with no discriminator - //'TestBasicInformation', - // TestGeneralCommissioning does reboots that need to have side-effects, so - // can't be tested in this test framework. - //'TestGeneralCommissioning', - 'TestGroupsCluster', - 'TestGroupKeyManagementCluster', - 'TestIdentifyCluster', - 'TestLogCommands', - 'TestOperationalCredentialsCluster', - // 'TestSelfFabricRemoval', --> TODO: Integrate here when Darwin can live with current fabric going away - 'TestBinding', - 'TestUserLabelCluster', - ]; - - const SoftwareDiagnostics = [ - 'Test_TC_SWDIAG_1_1', - 'Test_TC_SWDIAG_2_1', - 'Test_TC_SWDIAG_3_1', - ]; - - const Subscriptions = [ - 'TestSubscribe_OnOff', - ]; - - const tests = [ - AccessControl, // - BinaryInput, // - BooleanState, // - BridgedActions, // - ColorControl, // - DeviceDiscovery, // - DeviceManagement, // - DoorLock, // - ElectricalMeasurement, // - EthernetNetworkDiagnostics, // - FlowMeasurement, // - GeneralCommissioning, // - Identify, // - IlluminanceMeasurement, // - LevelControl, // - MediaControl, // - ModeSelect, // - OccupancySensing, // - OnOff, // - PowerSource, // - PressureMeasurement, // - PumpConfigurationControl, // - PowerSourceConfiguration, // - RelativeHumidityMeasurement, // - Switch, // - TemperatureMeasurement, // - Thermostat, // - ThermostatUserConfiguration, // - ThreadNetworkDiagnostics, // - UserLabel, // - WiFiNetworkDiagnostics, // - WindowCovering, // - Others, // - SoftwareDiagnostics, // - Subscriptions, // - ]; - return tests.flat(1); -} - -// -// Module exports -// -exports.getTests = getTests; -exports.getManualTests = getManualTests; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h deleted file mode 100644 index f5a0ebf1e25ae0..00000000000000 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h +++ /dev/null @@ -1,1304 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// THIS FILE IS GENERATED BY ZAP - -#import - -@class CHIPDevice; - -NS_ASSUME_NONNULL_BEGIN - -/** - * Cluster Access Control - * - */ -@interface CHIPTestAccessControl : CHIPAccessControl - -- (void)writeAttributeSubjectsPerAccessControlEntryWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTargetsPerAccessControlEntryWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAccessControlEntriesPerFabricWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Account Login - * - */ -@interface CHIPTestAccountLogin : CHIPAccountLogin - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster AdministratorCommissioning - * - */ -@interface CHIPTestAdministratorCommissioning : CHIPAdministratorCommissioning - -- (void)writeAttributeWindowStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAdminFabricIndexWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAdminVendorIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Application Basic - * - */ -@interface CHIPTestApplicationBasic : CHIPApplicationBasic - -- (void)writeAttributeVendorNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeVendorIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeApplicationNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeProductIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeApplicationWithValue:(CHIPApplicationBasicClusterApplicationBasicApplication * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeApplicationVersionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAllowedVendorListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Application Launcher - * - */ -@interface CHIPTestApplicationLauncher : CHIPApplicationLauncher - -- (void)writeAttributeCatalogListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Audio Output - * - */ -@interface CHIPTestAudioOutput : CHIPAudioOutput - -- (void)writeAttributeOutputListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentOutputWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Barrier Control - * - */ -@interface CHIPTestBarrierControl : CHIPBarrierControl - -- (void)writeAttributeBarrierMovingStateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBarrierSafetyStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBarrierCapabilitiesWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBarrierPositionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Basic - * - */ -@interface CHIPTestBasic : CHIPBasic - -- (void)writeAttributeDataModelRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeVendorNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeVendorIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeProductNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeProductIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeHardwareVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeHardwareVersionStringWithValue:(NSString * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSoftwareVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSoftwareVersionStringWithValue:(NSString * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeManufacturingDateWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePartNumberWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeProductURLWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeProductLabelWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSerialNumberWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeReachableWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeUniqueIDWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCapabilityMinimaWithValue:(CHIPBasicClusterCapabilityMinimaStruct * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Binary Input (Basic) - * - */ -@interface CHIPTestBinaryInputBasic : CHIPBinaryInputBasic - -- (void)writeAttributeStatusFlagsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Binding - * - */ -@interface CHIPTestBinding : CHIPBinding - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Boolean State - * - */ -@interface CHIPTestBooleanState : CHIPBooleanState - -- (void)writeAttributeStateValueWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Bridged Actions - * - */ -@interface CHIPTestBridgedActions : CHIPBridgedActions - -- (void)writeAttributeActionListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeEndpointListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSetupUrlWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Bridged Device Basic - * - */ -@interface CHIPTestBridgedDeviceBasic : CHIPBridgedDeviceBasic - -- (void)writeAttributeVendorNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeVendorIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeProductNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeHardwareVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeHardwareVersionStringWithValue:(NSString * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSoftwareVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSoftwareVersionStringWithValue:(NSString * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeManufacturingDateWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePartNumberWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeProductURLWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeProductLabelWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSerialNumberWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeReachableWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeUniqueIDWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Channel - * - */ -@interface CHIPTestChannel : CHIPChannel - -- (void)writeAttributeChannelListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLineupWithValue:(CHIPChannelClusterLineupInfo * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentChannelWithValue:(CHIPChannelClusterChannelInfo * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Color Control - * - */ -@interface CHIPTestColorControl : CHIPColorControl - -- (void)writeAttributeCurrentHueWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentSaturationWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRemainingTimeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentXWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentYWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeDriftCompensationWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCompensationTextWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorTemperatureWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfPrimariesWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary1XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary1YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary1IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary2XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary2YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary2IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary3XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary3YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary3IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary4XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary4YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary4IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary5XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary5YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary5IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary6XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary6YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePrimary6IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeEnhancedCurrentHueWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeEnhancedColorModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorLoopActiveWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorLoopDirectionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorLoopTimeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorLoopStartEnhancedHueWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorLoopStoredEnhancedHueWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorCapabilitiesWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorTempPhysicalMinWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeColorTempPhysicalMaxWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCoupleColorTempToLevelMinMiredsWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Content Launcher - * - */ -@interface CHIPTestContentLauncher : CHIPContentLauncher - -- (void)writeAttributeAcceptHeaderWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Descriptor - * - */ -@interface CHIPTestDescriptor : CHIPDescriptor - -- (void)writeAttributeDeviceListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeServerListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClientListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePartsListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Diagnostic Logs - * - */ -@interface CHIPTestDiagnosticLogs : CHIPDiagnosticLogs - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Door Lock - * - */ -@interface CHIPTestDoorLock : CHIPDoorLock - -- (void)writeAttributeLockStateWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLockTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActuatorEnabledWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeDoorStateWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfTotalUsersSupportedWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfPINUsersSupportedWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfRFIDUsersSupportedWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfYearDaySchedulesSupportedPerUserWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfHolidaySchedulesSupportedWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxPINCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinPINCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxRFIDCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinRFIDCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSupportedOperatingModesWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Electrical Measurement - * - */ -@interface CHIPTestElectricalMeasurement : CHIPElectricalMeasurement - -- (void)writeAttributeMeasurementTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTotalActivePowerWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRmsVoltageWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRmsVoltageMinWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRmsVoltageMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRmsCurrentWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRmsCurrentMinWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRmsCurrentMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActivePowerWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActivePowerMinWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActivePowerMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Ethernet Network Diagnostics - * - */ -@interface CHIPTestEthernetNetworkDiagnostics : CHIPEthernetNetworkDiagnostics - -- (void)writeAttributePHYRateWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFullDuplexWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePacketRxCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePacketTxCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxErrCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCollisionCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeOverrunCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCarrierDetectWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTimeSinceResetWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Fan Control - * - */ -@interface CHIPTestFanControl : CHIPFanControl - -- (void)writeAttributePercentCurrentWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSpeedMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSpeedCurrentWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRockSupportWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeWindSupportWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Fixed Label - * - */ -@interface CHIPTestFixedLabel : CHIPFixedLabel - -- (void)writeAttributeLabelListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Flow Measurement - * - */ -@interface CHIPTestFlowMeasurement : CHIPFlowMeasurement - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster General Commissioning - * - */ -@interface CHIPTestGeneralCommissioning : CHIPGeneralCommissioning - -- (void)writeAttributeBasicCommissioningInfoWithValue:(CHIPGeneralCommissioningClusterBasicCommissioningInfo * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRegulatoryConfigWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLocationCapabilityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSupportsConcurrentConnectionWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster General Diagnostics - * - */ -@interface CHIPTestGeneralDiagnostics : CHIPGeneralDiagnostics - -- (void)writeAttributeNetworkInterfacesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRebootCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeUpTimeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTotalOperationalHoursWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBootReasonsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActiveHardwareFaultsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActiveRadioFaultsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActiveNetworkFaultsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Group Key Management - * - */ -@interface CHIPTestGroupKeyManagement : CHIPGroupKeyManagement - -- (void)writeAttributeGroupTableWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxGroupsPerFabricWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxGroupKeysPerFabricWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Groups - * - */ -@interface CHIPTestGroups : CHIPGroups - -- (void)writeAttributeNameSupportWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Identify - * - */ -@interface CHIPTestIdentify : CHIPIdentify - -- (void)writeAttributeIdentifyTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Illuminance Measurement - * - */ -@interface CHIPTestIlluminanceMeasurement : CHIPIlluminanceMeasurement - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLightSensorTypeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Keypad Input - * - */ -@interface CHIPTestKeypadInput : CHIPKeypadInput - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Level Control - * - */ -@interface CHIPTestLevelControl : CHIPLevelControl - -- (void)writeAttributeCurrentLevelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRemainingTimeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinLevelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxLevelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentFrequencyWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinFrequencyWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxFrequencyWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Localization Configuration - * - */ -@interface CHIPTestLocalizationConfiguration : CHIPLocalizationConfiguration - -- (void)writeAttributeSupportedLocalesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Low Power - * - */ -@interface CHIPTestLowPower : CHIPLowPower - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Media Input - * - */ -@interface CHIPTestMediaInput : CHIPMediaInput - -- (void)writeAttributeInputListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentInputWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Media Playback - * - */ -@interface CHIPTestMediaPlayback : CHIPMediaPlayback - -- (void)writeAttributeCurrentStateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStartTimeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeDurationWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSampledPositionWithValue:(CHIPMediaPlaybackClusterPlaybackPosition * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePlaybackSpeedWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSeekRangeEndWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSeekRangeStartWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Mode Select - * - */ -@interface CHIPTestModeSelect : CHIPModeSelect - -- (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Network Commissioning - * - */ -@interface CHIPTestNetworkCommissioning : CHIPNetworkCommissioning - -- (void)writeAttributeMaxNetworksWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNetworksWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeScanMaxTimeSecondsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeConnectMaxTimeSecondsWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLastNetworkingStatusWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLastNetworkIDWithValue:(NSData * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLastConnectErrorValueWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster OTA Software Update Provider - * - */ -@interface CHIPTestOtaSoftwareUpdateProvider : CHIPOtaSoftwareUpdateProvider - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster OTA Software Update Requestor - * - */ -@interface CHIPTestOtaSoftwareUpdateRequestor : CHIPOtaSoftwareUpdateRequestor - -- (void)writeAttributeUpdatePossibleWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeUpdateStateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeUpdateStateProgressWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Occupancy Sensing - * - */ -@interface CHIPTestOccupancySensing : CHIPOccupancySensing - -- (void)writeAttributeOccupancyWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeOccupancySensorTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeOccupancySensorTypeBitmapWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster On/Off - * - */ -@interface CHIPTestOnOff : CHIPOnOff - -- (void)writeAttributeOnOffWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGlobalSceneControlWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster On/off Switch Configuration - * - */ -@interface CHIPTestOnOffSwitchConfiguration : CHIPOnOffSwitchConfiguration - -- (void)writeAttributeSwitchTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Operational Credentials - * - */ -@interface CHIPTestOperationalCredentials : CHIPOperationalCredentials - -- (void)writeAttributeNOCsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFabricsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSupportedFabricsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCommissionedFabricsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTrustedRootCertificatesWithValue:(NSArray * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentFabricIndexWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Power Source - * - */ -@interface CHIPTestPowerSource : CHIPPowerSource - -- (void)writeAttributeStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeOrderWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBatteryVoltageWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBatteryPercentRemainingWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBatteryTimeRemainingWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBatteryChargeLevelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActiveBatteryFaultsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBatteryChargeStateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Power Source Configuration - * - */ -@interface CHIPTestPowerSourceConfiguration : CHIPPowerSourceConfiguration - -- (void)writeAttributeSourcesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Pressure Measurement - * - */ -@interface CHIPTestPressureMeasurement : CHIPPressureMeasurement - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Pump Configuration and Control - * - */ -@interface CHIPTestPumpConfigurationAndControl : CHIPPumpConfigurationAndControl - -- (void)writeAttributeMaxPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxSpeedWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxFlowWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinConstPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxConstPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinCompPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxCompPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinConstSpeedWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxConstSpeedWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinConstFlowWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxConstFlowWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinConstTempWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxConstTempWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePumpStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeEffectiveOperationModeWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeEffectiveControlModeWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCapacityWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSpeedWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePowerWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAlarmMaskWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Relative Humidity Measurement - * - */ -@interface CHIPTestRelativeHumidityMeasurement : CHIPRelativeHumidityMeasurement - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Scenes - * - */ -@interface CHIPTestScenes : CHIPScenes - -- (void)writeAttributeSceneCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentSceneWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentGroupWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSceneValidWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNameSupportWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Software Diagnostics - * - */ -@interface CHIPTestSoftwareDiagnostics : CHIPSoftwareDiagnostics - -- (void)writeAttributeThreadMetricsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentHeapFreeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentHeapUsedWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentHeapHighWatermarkWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Switch - * - */ -@interface CHIPTestSwitch : CHIPSwitch - -- (void)writeAttributeNumberOfPositionsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentPositionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMultiPressMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Target Navigator - * - */ -@interface CHIPTestTargetNavigator : CHIPTargetNavigator - -- (void)writeAttributeTargetListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentTargetWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Temperature Measurement - * - */ -@interface CHIPTestTemperatureMeasurement : CHIPTemperatureMeasurement - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Test Cluster - * - */ -@interface CHIPTestTestCluster : CHIPTestCluster - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Thermostat - * - */ -@interface CHIPTestThermostat : CHIPThermostat - -- (void)writeAttributeLocalTemperatureWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAbsMinHeatSetpointLimitWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAbsMaxHeatSetpointLimitWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAbsMinCoolSetpointLimitWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAbsMaxCoolSetpointLimitWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStartOfWeekWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfWeeklyTransitionsWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNumberOfDailyTransitionsWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Thermostat User Interface Configuration - * - */ -@interface CHIPTestThermostatUserInterfaceConfiguration : CHIPThermostatUserInterfaceConfiguration - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Thread Network Diagnostics - * - */ -@interface CHIPTestThreadNetworkDiagnostics : CHIPThreadNetworkDiagnostics - -- (void)writeAttributeChannelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRoutingRoleWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNetworkNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePanIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeExtendedPanIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeMeshLocalPrefixWithValue:(NSData * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeOverrunCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeNeighborTableListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRouteTableListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePartitionIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeWeightingWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeDataVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStableDataVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLeaderRouterIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeDetachedRoleCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeChildRoleCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRouterRoleCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeLeaderRoleCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttachAttemptCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePartitionIdChangeCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBetterPartitionAttachAttemptCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeParentChangeCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxTotalCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxUnicastCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxBroadcastCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxAckRequestedCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxAckedCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxNoAckRequestedCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxDataCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxDataPollCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxBeaconCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxBeaconRequestCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxOtherCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxRetryCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxDirectMaxRetryExpiryCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxIndirectMaxRetryExpiryCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxErrCcaCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxErrAbortCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTxErrBusyChannelCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxTotalCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxUnicastCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxBroadcastCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxDataCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxDataPollCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxBeaconCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxBeaconRequestCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxOtherCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxAddressFilteredCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxDestAddrFilteredCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxDuplicatedCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxErrNoFrameCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxErrUnknownNeighborCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxErrInvalidSrcAddrCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxErrSecCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxErrFcsCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRxErrOtherCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActiveTimestampWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePendingTimestampWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeDelayWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSecurityPolicyWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeChannelMaskWithValue:(NSData * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeOperationalDatasetComponentsWithValue:(NSArray * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeActiveNetworkFaultsListWithValue:(NSArray * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Time Format Localization - * - */ -@interface CHIPTestTimeFormatLocalization : CHIPTimeFormatLocalization - -- (void)writeAttributeSupportedCalendarTypesWithValue:(NSArray * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Unit Localization - * - */ -@interface CHIPTestUnitLocalization : CHIPUnitLocalization - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster User Label - * - */ -@interface CHIPTestUserLabel : CHIPUserLabel - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Wake on LAN - * - */ -@interface CHIPTestWakeOnLan : CHIPWakeOnLan - -- (void)writeAttributeMACAddressWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster WiFi Network Diagnostics - * - */ -@interface CHIPTestWiFiNetworkDiagnostics : CHIPWiFiNetworkDiagnostics - -- (void)writeAttributeBssidWithValue:(NSData * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSecurityTypeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeWiFiVersionWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeChannelNumberWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeRssiWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBeaconLostCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeBeaconRxCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePacketMulticastRxCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePacketMulticastTxCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePacketUnicastRxCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributePacketUnicastTxCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentMaxRateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeOverrunCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -/** - * Cluster Window Covering - * - */ -@interface CHIPTestWindowCovering : CHIPWindowCovering - -- (void)writeAttributeTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentPositionLiftWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentPositionTiltWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeConfigStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentPositionLiftPercentageWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentPositionTiltPercentageWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeOperationalStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTargetPositionLiftPercent100thsWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeTargetPositionTiltPercent100thsWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeEndProductTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentPositionLiftPercent100thsWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeCurrentPositionTiltPercent100thsWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeInstalledOpenLimitLiftWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeInstalledClosedLimitLiftWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeInstalledOpenLimitTiltWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeInstalledClosedLimitTiltWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSafetyStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - -@end - -NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm deleted file mode 100644 index dfcc84369068fb..00000000000000 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ /dev/null @@ -1,17157 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// THIS FILE IS GENERATED BY ZAP -#import -#import - -#import "CHIPCallbackBridge_internal.h" -#import "CHIPCluster_internal.h" -#import "CHIPDevice.h" -#import "CHIPDevice_Internal.h" - -#import "zap-generated/CHIPTestClustersObjc.h" -#import "zap-generated/tests/CHIPClustersTest.h" - -#include -#include - -using chip::Callback::Callback; -using chip::Callback::Cancelable; -using namespace chip::app::Clusters; - -@interface CHIPTestAccessControl () -@property (readonly) chip::Controller::AccessControlClusterTest cppCluster; -@end - -@implementation CHIPTestAccessControl - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeSubjectsPerAccessControlEntryWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccessControl::Attributes::SubjectsPerAccessControlEntry::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTargetsPerAccessControlEntryWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccessControl::Attributes::TargetsPerAccessControlEntry::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAccessControlEntriesPerFabricWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccessControl::Attributes::AccessControlEntriesPerFabric::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccessControl::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccessControl::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccessControl::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccessControl::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestAccountLogin () -@property (readonly) chip::Controller::AccountLoginClusterTest cppCluster; -@end - -@implementation CHIPTestAccountLogin - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AccountLogin::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestAdministratorCommissioning () -@property (readonly) chip::Controller::AdministratorCommissioningClusterTest cppCluster; -@end - -@implementation CHIPTestAdministratorCommissioning - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeWindowStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AdministratorCommissioning::Attributes::WindowStatus::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAdminFabricIndexWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AdministratorCommissioning::Attributes::AdminFabricIndex::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAdminVendorIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AdministratorCommissioning::Attributes::AdminVendorId::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AdministratorCommissioning::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AdministratorCommissioning::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AdministratorCommissioning::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AdministratorCommissioning::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestApplicationBasic () -@property (readonly) chip::Controller::ApplicationBasicClusterTest cppCluster; -@end - -@implementation CHIPTestApplicationBasic - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeVendorNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeVendorIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::VendorID::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeApplicationNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeProductIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::ProductID::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeApplicationWithValue:(CHIPApplicationBasicClusterApplicationBasicApplication * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; - TypeInfo::Type cppValue; - cppValue.catalogVendorId = value.catalogVendorId.unsignedShortValue; - cppValue.applicationId = [self asCharSpan:value.applicationId]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeApplicationVersionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAllowedVendorListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = static_castmList[i_0])>>( - element_0.unsignedShortValue); - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationBasic::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestApplicationLauncher () -@property (readonly) chip::Controller::ApplicationLauncherClusterTest cppCluster; -@end - -@implementation CHIPTestApplicationLauncher - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeCatalogListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedShortValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestAudioOutput () -@property (readonly) chip::Controller::AudioOutputClusterTest cppCluster; -@end - -@implementation CHIPTestAudioOutput - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeOutputListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPAudioOutputClusterOutputInfo class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPAudioOutputClusterOutputInfo *) value[i_0]; - listHolder_0->mList[i_0].index = element_0.index.unsignedCharValue; - listHolder_0->mList[i_0].outputType - = static_castmList[i_0].outputType)>>( - element_0.outputType.unsignedCharValue); - listHolder_0->mList[i_0].name = [self asCharSpan:element_0.name]; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentOutputWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AudioOutput::Attributes::CurrentOutput::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = AudioOutput::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestBarrierControl () -@property (readonly) chip::Controller::BarrierControlClusterTest cppCluster; -@end - -@implementation CHIPTestBarrierControl - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeBarrierMovingStateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BarrierControl::Attributes::BarrierMovingState::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBarrierSafetyStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BarrierControl::Attributes::BarrierSafetyStatus::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBarrierCapabilitiesWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BarrierControl::Attributes::BarrierCapabilities::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBarrierPositionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BarrierControl::Attributes::BarrierPosition::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BarrierControl::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BarrierControl::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BarrierControl::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BarrierControl::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestBasic () -@property (readonly) chip::Controller::BasicClusterTest cppCluster; -@end - -@implementation CHIPTestBasic - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeDataModelRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::DataModelRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeVendorNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::VendorName::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeVendorIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::VendorID::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedShortValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeProductNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::ProductName::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeProductIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::ProductID::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeHardwareVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::HardwareVersion::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeHardwareVersionStringWithValue:(NSString * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::HardwareVersionString::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSoftwareVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::SoftwareVersion::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSoftwareVersionStringWithValue:(NSString * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::SoftwareVersionString::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeManufacturingDateWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::ManufacturingDate::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePartNumberWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::PartNumber::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeProductURLWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::ProductURL::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeProductLabelWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::ProductLabel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSerialNumberWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::SerialNumber::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeReachableWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::Reachable::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeUniqueIDWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::UniqueID::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCapabilityMinimaWithValue:(CHIPBasicClusterCapabilityMinimaStruct * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::CapabilityMinima::TypeInfo; - TypeInfo::Type cppValue; - cppValue.caseSessionsPerFabric = value.caseSessionsPerFabric.unsignedShortValue; - cppValue.subscriptionsPerFabric = value.subscriptionsPerFabric.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Basic::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestBinaryInputBasic () -@property (readonly) chip::Controller::BinaryInputBasicClusterTest cppCluster; -@end - -@implementation CHIPTestBinaryInputBasic - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeStatusFlagsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BinaryInputBasic::Attributes::StatusFlags::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BinaryInputBasic::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BinaryInputBasic::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BinaryInputBasic::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BinaryInputBasic::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestBinding () -@property (readonly) chip::Controller::BindingClusterTest cppCluster; -@end - -@implementation CHIPTestBinding - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Binding::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Binding::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Binding::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Binding::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestBooleanState () -@property (readonly) chip::Controller::BooleanStateClusterTest cppCluster; -@end - -@implementation CHIPTestBooleanState - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeStateValueWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BooleanState::Attributes::StateValue::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BooleanState::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BooleanState::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BooleanState::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BooleanState::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestBridgedActions () -@property (readonly) chip::Controller::BridgedActionsClusterTest cppCluster; -@end - -@implementation CHIPTestBridgedActions - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeActionListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedActions::Attributes::ActionList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPBridgedActionsClusterActionStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPBridgedActionsClusterActionStruct *) value[i_0]; - listHolder_0->mList[i_0].actionID = element_0.actionID.unsignedShortValue; - listHolder_0->mList[i_0].name = [self asCharSpan:element_0.name]; - listHolder_0->mList[i_0].type - = static_castmList[i_0].type)>>( - element_0.type.unsignedCharValue); - listHolder_0->mList[i_0].endpointListID = element_0.endpointListID.unsignedShortValue; - listHolder_0->mList[i_0].supportedCommands = element_0.supportedCommands.unsignedShortValue; - listHolder_0->mList[i_0].status - = static_castmList[i_0].status)>>( - element_0.status.unsignedCharValue); - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeEndpointListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedActions::Attributes::EndpointList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPBridgedActionsClusterEndpointListStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPBridgedActionsClusterEndpointListStruct *) value[i_0]; - listHolder_0->mList[i_0].endpointListID = element_0.endpointListID.unsignedShortValue; - listHolder_0->mList[i_0].name = [self asCharSpan:element_0.name]; - listHolder_0->mList[i_0].type - = static_castmList[i_0].type)>>( - element_0.type.unsignedCharValue); - { - using ListType_2 = std::remove_reference_tmList[i_0].endpoints)>; - using ListMemberType_2 = ListMemberTypeGetter::Type; - if (element_0.endpoints.count != 0) { - auto * listHolder_2 = new ListHolder(element_0.endpoints.count); - if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_2); - for (size_t i_2 = 0; i_2 < element_0.endpoints.count; ++i_2) { - if (![element_0.endpoints[i_2] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_2 = (NSNumber *) element_0.endpoints[i_2]; - listHolder_2->mList[i_2] = element_2.unsignedShortValue; - } - listHolder_0->mList[i_0].endpoints = ListType_2(listHolder_2->mList, element_0.endpoints.count); - } else { - listHolder_0->mList[i_0].endpoints = ListType_2(); - } - } - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSetupUrlWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedActions::Attributes::SetupUrl::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedActions::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedActions::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedActions::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedActions::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestBridgedDeviceBasic () -@property (readonly) chip::Controller::BridgedDeviceBasicClusterTest cppCluster; -@end - -@implementation CHIPTestBridgedDeviceBasic - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeVendorNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::VendorName::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeVendorIDWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::VendorID::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedShortValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeProductNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::ProductName::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeHardwareVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::HardwareVersion::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeHardwareVersionStringWithValue:(NSString * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::HardwareVersionString::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSoftwareVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::SoftwareVersion::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSoftwareVersionStringWithValue:(NSString * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::SoftwareVersionString::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeManufacturingDateWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::ManufacturingDate::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePartNumberWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::PartNumber::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeProductURLWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::ProductURL::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeProductLabelWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::ProductLabel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSerialNumberWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::SerialNumber::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeReachableWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::Reachable::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeUniqueIDWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::UniqueID::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = BridgedDeviceBasic::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestChannel () -@property (readonly) chip::Controller::ChannelClusterTest cppCluster; -@end - -@implementation CHIPTestChannel - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeChannelListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Channel::Attributes::ChannelList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPChannelClusterChannelInfo class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPChannelClusterChannelInfo *) value[i_0]; - listHolder_0->mList[i_0].majorNumber = element_0.majorNumber.unsignedShortValue; - listHolder_0->mList[i_0].minorNumber = element_0.minorNumber.unsignedShortValue; - if (element_0.name != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].name.Emplace(); - definedValue_2 = [self asCharSpan:element_0.name]; - } - if (element_0.callSign != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].callSign.Emplace(); - definedValue_2 = [self asCharSpan:element_0.callSign]; - } - if (element_0.affiliateCallSign != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].affiliateCallSign.Emplace(); - definedValue_2 = [self asCharSpan:element_0.affiliateCallSign]; - } - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLineupWithValue:(CHIPChannelClusterLineupInfo * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Channel::Attributes::Lineup::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0.operatorName = [self asCharSpan:value.operatorName]; - if (value.lineupName != nil) { - auto & definedValue_2 = nonNullValue_0.lineupName.Emplace(); - definedValue_2 = [self asCharSpan:value.lineupName]; - } - if (value.postalCode != nil) { - auto & definedValue_2 = nonNullValue_0.postalCode.Emplace(); - definedValue_2 = [self asCharSpan:value.postalCode]; - } - nonNullValue_0.lineupInfoType = static_cast>( - value.lineupInfoType.unsignedCharValue); - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentChannelWithValue:(CHIPChannelClusterChannelInfo * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Channel::Attributes::CurrentChannel::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0.majorNumber = value.majorNumber.unsignedShortValue; - nonNullValue_0.minorNumber = value.minorNumber.unsignedShortValue; - if (value.name != nil) { - auto & definedValue_2 = nonNullValue_0.name.Emplace(); - definedValue_2 = [self asCharSpan:value.name]; - } - if (value.callSign != nil) { - auto & definedValue_2 = nonNullValue_0.callSign.Emplace(); - definedValue_2 = [self asCharSpan:value.callSign]; - } - if (value.affiliateCallSign != nil) { - auto & definedValue_2 = nonNullValue_0.affiliateCallSign.Emplace(); - definedValue_2 = [self asCharSpan:value.affiliateCallSign]; - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Channel::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Channel::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Channel::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Channel::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestColorControl () -@property (readonly) chip::Controller::ColorControlClusterTest cppCluster; -@end - -@implementation CHIPTestColorControl - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeCurrentHueWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::CurrentHue::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentSaturationWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::CurrentSaturation::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRemainingTimeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::RemainingTime::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentXWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::CurrentX::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentYWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::CurrentY::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeDriftCompensationWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::DriftCompensation::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCompensationTextWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::CompensationText::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorTemperatureWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorTemperature::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorMode::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfPrimariesWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::NumberOfPrimaries::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary1XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary1X::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary1YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary1Y::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary1IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary1Intensity::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary2XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary2X::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary2YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary2Y::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary2IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary2Intensity::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary3XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary3X::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary3YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary3Y::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary3IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary3Intensity::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary4XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary4X::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary4YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary4Y::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary4IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary4Intensity::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary5XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary5X::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary5YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary5Y::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary5IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary5Intensity::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary6XWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary6X::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary6YWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary6Y::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePrimary6IntensityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::Primary6Intensity::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeEnhancedCurrentHueWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::EnhancedCurrentHue::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeEnhancedColorModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::EnhancedColorMode::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorLoopActiveWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorLoopActive::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorLoopDirectionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorLoopDirection::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorLoopTimeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorLoopTime::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorLoopStartEnhancedHueWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorLoopStartEnhancedHue::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorLoopStoredEnhancedHueWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorLoopStoredEnhancedHue::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorCapabilitiesWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorCapabilities::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorTempPhysicalMinWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorTempPhysicalMin::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeColorTempPhysicalMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ColorTempPhysicalMax::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCoupleColorTempToLevelMinMiredsWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::CoupleColorTempToLevelMinMireds::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ColorControl::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestContentLauncher () -@property (readonly) chip::Controller::ContentLauncherClusterTest cppCluster; -@end - -@implementation CHIPTestContentLauncher - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeAcceptHeaderWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSString class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSString *) value[i_0]; - listHolder_0->mList[i_0] = [self asCharSpan:element_0]; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ContentLauncher::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestDescriptor () -@property (readonly) chip::Controller::DescriptorClusterTest cppCluster; -@end - -@implementation CHIPTestDescriptor - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeDeviceListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Descriptor::Attributes::DeviceList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPDescriptorClusterDeviceType class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPDescriptorClusterDeviceType *) value[i_0]; - listHolder_0->mList[i_0].type = element_0.type.unsignedIntValue; - listHolder_0->mList[i_0].revision = element_0.revision.unsignedShortValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeServerListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Descriptor::Attributes::ServerList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClientListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Descriptor::Attributes::ClientList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePartsListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Descriptor::Attributes::PartsList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedShortValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Descriptor::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Descriptor::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Descriptor::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Descriptor::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestDiagnosticLogs () -@property (readonly) chip::Controller::DiagnosticLogsClusterTest cppCluster; -@end - -@implementation CHIPTestDiagnosticLogs - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DiagnosticLogs::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DiagnosticLogs::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DiagnosticLogs::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestDoorLock () -@property (readonly) chip::Controller::DoorLockClusterTest cppCluster; -@end - -@implementation CHIPTestDoorLock - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeLockStateWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = static_cast>(value.unsignedCharValue); - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLockTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActuatorEnabledWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::ActuatorEnabled::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeDoorStateWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = static_cast>(value.unsignedCharValue); - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfTotalUsersSupportedWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::NumberOfTotalUsersSupported::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfPINUsersSupportedWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::NumberOfPINUsersSupported::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfRFIDUsersSupportedWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::NumberOfRFIDUsersSupported::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfYearDaySchedulesSupportedPerUserWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfHolidaySchedulesSupportedWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::NumberOfHolidaySchedulesSupported::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxPINCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::MaxPINCodeLength::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinPINCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::MinPINCodeLength::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxRFIDCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::MaxRFIDCodeLength::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinRFIDCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::MinRFIDCodeLength::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSupportedOperatingModesWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedShortValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestElectricalMeasurement () -@property (readonly) chip::Controller::ElectricalMeasurementClusterTest cppCluster; -@end - -@implementation CHIPTestElectricalMeasurement - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMeasurementTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::MeasurementType::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTotalActivePowerWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::TotalActivePower::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.intValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRmsVoltageWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::RmsVoltage::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRmsVoltageMinWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::RmsVoltageMin::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRmsVoltageMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::RmsVoltageMax::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRmsCurrentWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::RmsCurrent::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRmsCurrentMinWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::RmsCurrentMin::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRmsCurrentMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::RmsCurrentMax::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActivePowerWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::ActivePower::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.shortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActivePowerMinWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::ActivePowerMin::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.shortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActivePowerMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::ActivePowerMax::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.shortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ElectricalMeasurement::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestEthernetNetworkDiagnostics () -@property (readonly) chip::Controller::EthernetNetworkDiagnosticsClusterTest cppCluster; -@end - -@implementation CHIPTestEthernetNetworkDiagnostics - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributePHYRateWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::PHYRate::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = static_cast>(value.unsignedCharValue); - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFullDuplexWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::FullDuplex::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.boolValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePacketRxCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::PacketRxCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePacketTxCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::PacketTxCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxErrCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::TxErrCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCollisionCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::CollisionCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeOverrunCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::OverrunCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCarrierDetectWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::CarrierDetect::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.boolValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTimeSinceResetWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::TimeSinceReset::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = EthernetNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestFanControl () -@property (readonly) chip::Controller::FanControlClusterTest cppCluster; -@end - -@implementation CHIPTestFanControl - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributePercentCurrentWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::PercentCurrent::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSpeedMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::SpeedMax::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSpeedCurrentWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::SpeedCurrent::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRockSupportWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::RockSupport::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeWindSupportWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::WindSupport::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FanControl::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestFixedLabel () -@property (readonly) chip::Controller::FixedLabelClusterTest cppCluster; -@end - -@implementation CHIPTestFixedLabel - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeLabelListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FixedLabel::Attributes::LabelList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPFixedLabelClusterLabelStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPFixedLabelClusterLabelStruct *) value[i_0]; - listHolder_0->mList[i_0].label = [self asCharSpan:element_0.label]; - listHolder_0->mList[i_0].value = [self asCharSpan:element_0.value]; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FixedLabel::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FixedLabel::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FixedLabel::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FixedLabel::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestFlowMeasurement () -@property (readonly) chip::Controller::FlowMeasurementClusterTest cppCluster; -@end - -@implementation CHIPTestFlowMeasurement - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FlowMeasurement::Attributes::MeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FlowMeasurement::Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FlowMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FlowMeasurement::Attributes::Tolerance::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FlowMeasurement::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FlowMeasurement::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FlowMeasurement::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = FlowMeasurement::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestGeneralCommissioning () -@property (readonly) chip::Controller::GeneralCommissioningClusterTest cppCluster; -@end - -@implementation CHIPTestGeneralCommissioning - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeBasicCommissioningInfoWithValue:(CHIPGeneralCommissioningClusterBasicCommissioningInfo * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralCommissioning::Attributes::BasicCommissioningInfo::TypeInfo; - TypeInfo::Type cppValue; - cppValue.failSafeExpiryLengthSeconds = value.failSafeExpiryLengthSeconds.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRegulatoryConfigWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralCommissioning::Attributes::RegulatoryConfig::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLocationCapabilityWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralCommissioning::Attributes::LocationCapability::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSupportsConcurrentConnectionWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralCommissioning::Attributes::SupportsConcurrentConnection::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralCommissioning::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralCommissioning::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralCommissioning::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralCommissioning::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestGeneralDiagnostics () -@property (readonly) chip::Controller::GeneralDiagnosticsClusterTest cppCluster; -@end - -@implementation CHIPTestGeneralDiagnostics - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeNetworkInterfacesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::NetworkInterfaces::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPGeneralDiagnosticsClusterNetworkInterfaceType class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPGeneralDiagnosticsClusterNetworkInterfaceType *) value[i_0]; - listHolder_0->mList[i_0].name = [self asCharSpan:element_0.name]; - listHolder_0->mList[i_0].isOperational = element_0.isOperational.boolValue; - if (element_0.offPremiseServicesReachableIPv4 == nil) { - listHolder_0->mList[i_0].offPremiseServicesReachableIPv4.SetNull(); - } else { - auto & nonNullValue_2 = listHolder_0->mList[i_0].offPremiseServicesReachableIPv4.SetNonNull(); - nonNullValue_2 = element_0.offPremiseServicesReachableIPv4.boolValue; - } - if (element_0.offPremiseServicesReachableIPv6 == nil) { - listHolder_0->mList[i_0].offPremiseServicesReachableIPv6.SetNull(); - } else { - auto & nonNullValue_2 = listHolder_0->mList[i_0].offPremiseServicesReachableIPv6.SetNonNull(); - nonNullValue_2 = element_0.offPremiseServicesReachableIPv6.boolValue; - } - listHolder_0->mList[i_0].hardwareAddress = [self asByteSpan:element_0.hardwareAddress]; - { - using ListType_2 = std::remove_reference_tmList[i_0].IPv4Addresses)>; - using ListMemberType_2 = ListMemberTypeGetter::Type; - if (element_0.iPv4Addresses.count != 0) { - auto * listHolder_2 = new ListHolder(element_0.iPv4Addresses.count); - if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_2); - for (size_t i_2 = 0; i_2 < element_0.iPv4Addresses.count; ++i_2) { - if (![element_0.iPv4Addresses[i_2] isKindOfClass:[NSData class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_2 = (NSData *) element_0.iPv4Addresses[i_2]; - listHolder_2->mList[i_2] = [self asByteSpan:element_2]; - } - listHolder_0->mList[i_0].IPv4Addresses - = ListType_2(listHolder_2->mList, element_0.iPv4Addresses.count); - } else { - listHolder_0->mList[i_0].IPv4Addresses = ListType_2(); - } - } - { - using ListType_2 = std::remove_reference_tmList[i_0].IPv6Addresses)>; - using ListMemberType_2 = ListMemberTypeGetter::Type; - if (element_0.iPv6Addresses.count != 0) { - auto * listHolder_2 = new ListHolder(element_0.iPv6Addresses.count); - if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_2); - for (size_t i_2 = 0; i_2 < element_0.iPv6Addresses.count; ++i_2) { - if (![element_0.iPv6Addresses[i_2] isKindOfClass:[NSData class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_2 = (NSData *) element_0.iPv6Addresses[i_2]; - listHolder_2->mList[i_2] = [self asByteSpan:element_2]; - } - listHolder_0->mList[i_0].IPv6Addresses - = ListType_2(listHolder_2->mList, element_0.iPv6Addresses.count); - } else { - listHolder_0->mList[i_0].IPv6Addresses = ListType_2(); - } - } - listHolder_0->mList[i_0].type - = static_castmList[i_0].type)>>( - element_0.type.unsignedCharValue); - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRebootCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::RebootCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeUpTimeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::UpTime::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTotalOperationalHoursWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::TotalOperationalHours::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBootReasonsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::BootReasons::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActiveHardwareFaultsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::ActiveHardwareFaults::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedCharValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActiveRadioFaultsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::ActiveRadioFaults::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedCharValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActiveNetworkFaultsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::ActiveNetworkFaults::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedCharValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GeneralDiagnostics::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestGroupKeyManagement () -@property (readonly) chip::Controller::GroupKeyManagementClusterTest cppCluster; -@end - -@implementation CHIPTestGroupKeyManagement - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGroupTableWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::GroupTable::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPGroupKeyManagementClusterGroupInfoMapStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPGroupKeyManagementClusterGroupInfoMapStruct *) value[i_0]; - listHolder_0->mList[i_0].groupId = element_0.groupId.unsignedShortValue; - { - using ListType_2 = std::remove_reference_tmList[i_0].endpoints)>; - using ListMemberType_2 = ListMemberTypeGetter::Type; - if (element_0.endpoints.count != 0) { - auto * listHolder_2 = new ListHolder(element_0.endpoints.count); - if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_2); - for (size_t i_2 = 0; i_2 < element_0.endpoints.count; ++i_2) { - if (![element_0.endpoints[i_2] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_2 = (NSNumber *) element_0.endpoints[i_2]; - listHolder_2->mList[i_2] = element_2.unsignedShortValue; - } - listHolder_0->mList[i_0].endpoints = ListType_2(listHolder_2->mList, element_0.endpoints.count); - } else { - listHolder_0->mList[i_0].endpoints = ListType_2(); - } - } - if (element_0.groupName != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].groupName.Emplace(); - definedValue_2 = [self asCharSpan:element_0.groupName]; - } - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxGroupsPerFabricWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::MaxGroupsPerFabric::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxGroupKeysPerFabricWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestGroups () -@property (readonly) chip::Controller::GroupsClusterTest cppCluster; -@end - -@implementation CHIPTestGroups - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeNameSupportWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Groups::Attributes::NameSupport::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Groups::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Groups::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Groups::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Groups::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestIdentify () -@property (readonly) chip::Controller::IdentifyClusterTest cppCluster; -@end - -@implementation CHIPTestIdentify - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeIdentifyTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Identify::Attributes::IdentifyType::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Identify::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Identify::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Identify::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Identify::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestIlluminanceMeasurement () -@property (readonly) chip::Controller::IlluminanceMeasurementClusterTest cppCluster; -@end - -@implementation CHIPTestIlluminanceMeasurement - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::MeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::Tolerance::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLightSensorTypeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::LightSensorType::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = IlluminanceMeasurement::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestKeypadInput () -@property (readonly) chip::Controller::KeypadInputClusterTest cppCluster; -@end - -@implementation CHIPTestKeypadInput - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = KeypadInput::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestLevelControl () -@property (readonly) chip::Controller::LevelControlClusterTest cppCluster; -@end - -@implementation CHIPTestLevelControl - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeCurrentLevelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::CurrentLevel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRemainingTimeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::RemainingTime::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinLevelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::MinLevel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxLevelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::MaxLevel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentFrequencyWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::CurrentFrequency::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinFrequencyWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::MinFrequency::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxFrequencyWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::MaxFrequency::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LevelControl::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestLocalizationConfiguration () -@property (readonly) chip::Controller::LocalizationConfigurationClusterTest cppCluster; -@end - -@implementation CHIPTestLocalizationConfiguration - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeSupportedLocalesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LocalizationConfiguration::Attributes::SupportedLocales::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSString class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSString *) value[i_0]; - listHolder_0->mList[i_0] = [self asCharSpan:element_0]; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LocalizationConfiguration::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LocalizationConfiguration::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LocalizationConfiguration::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestLowPower () -@property (readonly) chip::Controller::LowPowerClusterTest cppCluster; -@end - -@implementation CHIPTestLowPower - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = LowPower::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestMediaInput () -@property (readonly) chip::Controller::MediaInputClusterTest cppCluster; -@end - -@implementation CHIPTestMediaInput - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeInputListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaInput::Attributes::InputList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPMediaInputClusterInputInfo class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPMediaInputClusterInputInfo *) value[i_0]; - listHolder_0->mList[i_0].index = element_0.index.unsignedCharValue; - listHolder_0->mList[i_0].inputType - = static_castmList[i_0].inputType)>>( - element_0.inputType.unsignedCharValue); - listHolder_0->mList[i_0].name = [self asCharSpan:element_0.name]; - listHolder_0->mList[i_0].description = [self asCharSpan:element_0.descriptionString]; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentInputWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaInput::Attributes::CurrentInput::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaInput::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaInput::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaInput::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaInput::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestMediaPlayback () -@property (readonly) chip::Controller::MediaPlaybackClusterTest cppCluster; -@end - -@implementation CHIPTestMediaPlayback - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeCurrentStateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::CurrentState::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeStartTimeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::StartTime::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedLongLongValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeDurationWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::Duration::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedLongLongValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSampledPositionWithValue:(CHIPMediaPlaybackClusterPlaybackPosition * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::SampledPosition::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0.updatedAt = value.updatedAt.unsignedLongLongValue; - if (value.position == nil) { - nonNullValue_0.position.SetNull(); - } else { - auto & nonNullValue_2 = nonNullValue_0.position.SetNonNull(); - nonNullValue_2 = value.position.unsignedLongLongValue; - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePlaybackSpeedWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::PlaybackSpeed::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.floatValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSeekRangeEndWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::SeekRangeEnd::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedLongLongValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSeekRangeStartWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::SeekRangeStart::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedLongLongValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = MediaPlayback::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestModeSelect () -@property (readonly) chip::Controller::ModeSelectClusterTest cppCluster; -@end - -@implementation CHIPTestModeSelect - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::StandardNamespace::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::SupportedModes::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPModeSelectClusterModeOptionStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPModeSelectClusterModeOptionStruct *) value[i_0]; - listHolder_0->mList[i_0].label = [self asCharSpan:element_0.label]; - listHolder_0->mList[i_0].mode = element_0.mode.unsignedCharValue; - listHolder_0->mList[i_0].semanticTag = element_0.semanticTag.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestNetworkCommissioning () -@property (readonly) chip::Controller::NetworkCommissioningClusterTest cppCluster; -@end - -@implementation CHIPTestNetworkCommissioning - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMaxNetworksWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::MaxNetworks::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNetworksWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::Networks::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPNetworkCommissioningClusterNetworkInfo class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPNetworkCommissioningClusterNetworkInfo *) value[i_0]; - listHolder_0->mList[i_0].networkID = [self asByteSpan:element_0.networkID]; - listHolder_0->mList[i_0].connected = element_0.connected.boolValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeScanMaxTimeSecondsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::ScanMaxTimeSeconds::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeConnectMaxTimeSecondsWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::ConnectMaxTimeSeconds::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLastNetworkingStatusWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::LastNetworkingStatus::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = static_cast>(value.unsignedCharValue); - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLastNetworkIDWithValue:(NSData * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::LastNetworkID::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = [self asByteSpan:value]; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLastConnectErrorValueWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::LastConnectErrorValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.intValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = NetworkCommissioning::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestOtaSoftwareUpdateProvider () -@property (readonly) chip::Controller::OtaSoftwareUpdateProviderClusterTest cppCluster; -@end - -@implementation CHIPTestOtaSoftwareUpdateProvider - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OtaSoftwareUpdateProvider::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OtaSoftwareUpdateProvider::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestOtaSoftwareUpdateRequestor () -@property (readonly) chip::Controller::OtaSoftwareUpdateRequestorClusterTest cppCluster; -@end - -@implementation CHIPTestOtaSoftwareUpdateRequestor - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeUpdatePossibleWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdatePossible::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeUpdateStateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdateState::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeUpdateStateProgressWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestOccupancySensing () -@property (readonly) chip::Controller::OccupancySensingClusterTest cppCluster; -@end - -@implementation CHIPTestOccupancySensing - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeOccupancyWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OccupancySensing::Attributes::Occupancy::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeOccupancySensorTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OccupancySensing::Attributes::OccupancySensorType::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeOccupancySensorTypeBitmapWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OccupancySensing::Attributes::OccupancySensorTypeBitmap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OccupancySensing::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OccupancySensing::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OccupancySensing::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OccupancySensing::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestOnOff () -@property (readonly) chip::Controller::OnOffClusterTest cppCluster; -@end - -@implementation CHIPTestOnOff - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeOnOffWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOff::Attributes::OnOff::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGlobalSceneControlWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOff::Attributes::GlobalSceneControl::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOff::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOff::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOff::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOff::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOff::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestOnOffSwitchConfiguration () -@property (readonly) chip::Controller::OnOffSwitchConfigurationClusterTest cppCluster; -@end - -@implementation CHIPTestOnOffSwitchConfiguration - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeSwitchTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOffSwitchConfiguration::Attributes::SwitchType::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOffSwitchConfiguration::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOffSwitchConfiguration::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOffSwitchConfiguration::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OnOffSwitchConfiguration::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestOperationalCredentials () -@property (readonly) chip::Controller::OperationalCredentialsClusterTest cppCluster; -@end - -@implementation CHIPTestOperationalCredentials - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeNOCsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::NOCs::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPOperationalCredentialsClusterNOCStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPOperationalCredentialsClusterNOCStruct *) value[i_0]; - listHolder_0->mList[i_0].noc = [self asByteSpan:element_0.noc]; - if (element_0.icac == nil) { - listHolder_0->mList[i_0].icac.SetNull(); - } else { - auto & nonNullValue_2 = listHolder_0->mList[i_0].icac.SetNonNull(); - nonNullValue_2 = [self asByteSpan:element_0.icac]; - } - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFabricsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::Fabrics::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPOperationalCredentialsClusterFabricDescriptor class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPOperationalCredentialsClusterFabricDescriptor *) value[i_0]; - listHolder_0->mList[i_0].rootPublicKey = [self asByteSpan:element_0.rootPublicKey]; - listHolder_0->mList[i_0].vendorId = element_0.vendorId.unsignedShortValue; - listHolder_0->mList[i_0].fabricId = element_0.fabricId.unsignedLongLongValue; - listHolder_0->mList[i_0].nodeId = element_0.nodeId.unsignedLongLongValue; - listHolder_0->mList[i_0].label = [self asCharSpan:element_0.label]; - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSupportedFabricsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::SupportedFabrics::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCommissionedFabricsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::CommissionedFabrics::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTrustedRootCertificatesWithValue:(NSArray * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::TrustedRootCertificates::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSData class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSData *) value[i_0]; - listHolder_0->mList[i_0] = [self asByteSpan:element_0]; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentFabricIndexWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::CurrentFabricIndex::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = OperationalCredentials::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestPowerSource () -@property (readonly) chip::Controller::PowerSourceClusterTest cppCluster; -@end - -@implementation CHIPTestPowerSource - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::Status::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeOrderWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::Order::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::Description::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBatteryVoltageWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::BatteryVoltage::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBatteryPercentRemainingWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::BatteryPercentRemaining::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBatteryTimeRemainingWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::BatteryTimeRemaining::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBatteryChargeLevelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::BatteryChargeLevel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActiveBatteryFaultsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::ActiveBatteryFaults::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedCharValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBatteryChargeStateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::BatteryChargeState::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSource::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestPowerSourceConfiguration () -@property (readonly) chip::Controller::PowerSourceConfigurationClusterTest cppCluster; -@end - -@implementation CHIPTestPowerSourceConfiguration - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeSourcesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSourceConfiguration::Attributes::Sources::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedCharValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSourceConfiguration::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSourceConfiguration::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSourceConfiguration::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PowerSourceConfiguration::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestPressureMeasurement () -@property (readonly) chip::Controller::PressureMeasurementClusterTest cppCluster; -@end - -@implementation CHIPTestPressureMeasurement - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PressureMeasurement::Attributes::MeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PressureMeasurement::Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PressureMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PressureMeasurement::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PressureMeasurement::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestPumpConfigurationAndControl () -@property (readonly) chip::Controller::PumpConfigurationAndControlClusterTest cppCluster; -@end - -@implementation CHIPTestPumpConfigurationAndControl - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMaxPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxPressure::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxSpeedWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxSpeed::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxFlowWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxFlow::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinConstPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstPressure::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxConstPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstPressure::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinCompPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MinCompPressure::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxCompPressureWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxCompPressure::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinConstSpeedWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstSpeed::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxConstSpeedWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstSpeed::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinConstFlowWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstFlow::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxConstFlowWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstFlow::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinConstTempWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstTemp::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxConstTempWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstTemp::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePumpStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::PumpStatus::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeEffectiveOperationModeWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::EffectiveOperationMode::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeEffectiveControlModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::EffectiveControlMode::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCapacityWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::Capacity::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSpeedWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::Speed::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePowerWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::Power::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedIntValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAlarmMaskWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::AlarmMask::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = PumpConfigurationAndControl::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestRelativeHumidityMeasurement () -@property (readonly) chip::Controller::RelativeHumidityMeasurementClusterTest cppCluster; -@end - -@implementation CHIPTestRelativeHumidityMeasurement - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = RelativeHumidityMeasurement::Attributes::MeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = RelativeHumidityMeasurement::Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = RelativeHumidityMeasurement::Attributes::Tolerance::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = RelativeHumidityMeasurement::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = RelativeHumidityMeasurement::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = RelativeHumidityMeasurement::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = RelativeHumidityMeasurement::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestScenes () -@property (readonly) chip::Controller::ScenesClusterTest cppCluster; -@end - -@implementation CHIPTestScenes - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeSceneCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::SceneCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentSceneWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::CurrentScene::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentGroupWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::CurrentGroup::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSceneValidWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::SceneValid::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNameSupportWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::NameSupport::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Scenes::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestSoftwareDiagnostics () -@property (readonly) chip::Controller::SoftwareDiagnosticsClusterTest cppCluster; -@end - -@implementation CHIPTestSoftwareDiagnostics - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeThreadMetricsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::ThreadMetrics::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPSoftwareDiagnosticsClusterThreadMetrics class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPSoftwareDiagnosticsClusterThreadMetrics *) value[i_0]; - listHolder_0->mList[i_0].id = element_0.id.unsignedLongLongValue; - listHolder_0->mList[i_0].name = [self asCharSpan:element_0.name]; - listHolder_0->mList[i_0].stackFreeCurrent = element_0.stackFreeCurrent.unsignedIntValue; - listHolder_0->mList[i_0].stackFreeMinimum = element_0.stackFreeMinimum.unsignedIntValue; - listHolder_0->mList[i_0].stackSize = element_0.stackSize.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentHeapFreeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::CurrentHeapFree::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentHeapUsedWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::CurrentHeapUsed::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentHeapHighWatermarkWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::CurrentHeapHighWatermark::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = SoftwareDiagnostics::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestSwitch () -@property (readonly) chip::Controller::SwitchClusterTest cppCluster; -@end - -@implementation CHIPTestSwitch - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeNumberOfPositionsWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Switch::Attributes::NumberOfPositions::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentPositionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Switch::Attributes::CurrentPosition::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMultiPressMaxWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Switch::Attributes::MultiPressMax::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Switch::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Switch::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Switch::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Switch::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Switch::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestTargetNavigator () -@property (readonly) chip::Controller::TargetNavigatorClusterTest cppCluster; -@end - -@implementation CHIPTestTargetNavigator - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeTargetListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TargetNavigator::Attributes::TargetList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPTargetNavigatorClusterTargetInfo class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPTargetNavigatorClusterTargetInfo *) value[i_0]; - listHolder_0->mList[i_0].identifier = element_0.identifier.unsignedCharValue; - listHolder_0->mList[i_0].name = [self asCharSpan:element_0.name]; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentTargetWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TargetNavigator::Attributes::CurrentTarget::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TargetNavigator::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TargetNavigator::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TargetNavigator::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TargetNavigator::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestTemperatureMeasurement () -@property (readonly) chip::Controller::TemperatureMeasurementClusterTest cppCluster; -@end - -@implementation CHIPTestTemperatureMeasurement - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TemperatureMeasurement::Attributes::MeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMinMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TemperatureMeasurement::Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMaxMeasuredValueWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TemperatureMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.shortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeToleranceWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TemperatureMeasurement::Attributes::Tolerance::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TemperatureMeasurement::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TemperatureMeasurement::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestTestCluster () -@property (readonly) chip::Controller::TestClusterClusterTest cppCluster; -@end - -@implementation CHIPTestTestCluster - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TestCluster::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TestCluster::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TestCluster::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TestCluster::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestThermostat () -@property (readonly) chip::Controller::ThermostatClusterTest cppCluster; -@end - -@implementation CHIPTestThermostat - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeLocalTemperatureWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::LocalTemperature::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.shortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAbsMinHeatSetpointLimitWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::AbsMinHeatSetpointLimit::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.shortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAbsMaxHeatSetpointLimitWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::AbsMaxHeatSetpointLimit::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.shortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAbsMinCoolSetpointLimitWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::AbsMinCoolSetpointLimit::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.shortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAbsMaxCoolSetpointLimitWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::AbsMaxCoolSetpointLimit::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.shortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeStartOfWeekWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::StartOfWeek::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfWeeklyTransitionsWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::NumberOfWeeklyTransitions::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNumberOfDailyTransitionsWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::NumberOfDailyTransitions::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestThermostatUserInterfaceConfiguration () -@property (readonly) chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cppCluster; -@end - -@implementation CHIPTestThermostatUserInterfaceConfiguration - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestThreadNetworkDiagnostics () -@property (readonly) chip::Controller::ThreadNetworkDiagnosticsClusterTest cppCluster; -@end - -@implementation CHIPTestThreadNetworkDiagnostics - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeChannelWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::Channel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRoutingRoleWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RoutingRole::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNetworkNameWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::NetworkName::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePanIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::PanId::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeExtendedPanIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ExtendedPanId::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeMeshLocalPrefixWithValue:(NSData * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asByteSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeOverrunCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::OverrunCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeNeighborTableListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::NeighborTableList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPThreadNetworkDiagnosticsClusterNeighborTable class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPThreadNetworkDiagnosticsClusterNeighborTable *) value[i_0]; - listHolder_0->mList[i_0].extAddress = element_0.extAddress.unsignedLongLongValue; - listHolder_0->mList[i_0].age = element_0.age.unsignedIntValue; - listHolder_0->mList[i_0].rloc16 = element_0.rloc16.unsignedShortValue; - listHolder_0->mList[i_0].linkFrameCounter = element_0.linkFrameCounter.unsignedIntValue; - listHolder_0->mList[i_0].mleFrameCounter = element_0.mleFrameCounter.unsignedIntValue; - listHolder_0->mList[i_0].lqi = element_0.lqi.unsignedCharValue; - listHolder_0->mList[i_0].averageRssi = element_0.averageRssi.charValue; - listHolder_0->mList[i_0].lastRssi = element_0.lastRssi.charValue; - listHolder_0->mList[i_0].frameErrorRate = element_0.frameErrorRate.unsignedCharValue; - listHolder_0->mList[i_0].messageErrorRate = element_0.messageErrorRate.unsignedCharValue; - listHolder_0->mList[i_0].rxOnWhenIdle = element_0.rxOnWhenIdle.boolValue; - listHolder_0->mList[i_0].fullThreadDevice = element_0.fullThreadDevice.boolValue; - listHolder_0->mList[i_0].fullNetworkData = element_0.fullNetworkData.boolValue; - listHolder_0->mList[i_0].isChild = element_0.isChild.boolValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRouteTableListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RouteTableList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPThreadNetworkDiagnosticsClusterRouteTable class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPThreadNetworkDiagnosticsClusterRouteTable *) value[i_0]; - listHolder_0->mList[i_0].extAddress = element_0.extAddress.unsignedLongLongValue; - listHolder_0->mList[i_0].rloc16 = element_0.rloc16.unsignedShortValue; - listHolder_0->mList[i_0].routerId = element_0.routerId.unsignedCharValue; - listHolder_0->mList[i_0].nextHop = element_0.nextHop.unsignedCharValue; - listHolder_0->mList[i_0].pathCost = element_0.pathCost.unsignedCharValue; - listHolder_0->mList[i_0].LQIIn = element_0.lqiIn.unsignedCharValue; - listHolder_0->mList[i_0].LQIOut = element_0.lqiOut.unsignedCharValue; - listHolder_0->mList[i_0].age = element_0.age.unsignedCharValue; - listHolder_0->mList[i_0].allocated = element_0.allocated.boolValue; - listHolder_0->mList[i_0].linkEstablished = element_0.linkEstablished.boolValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePartitionIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::PartitionId::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeWeightingWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::Weighting::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeDataVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::DataVersion::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeStableDataVersionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::StableDataVersion::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLeaderRouterIdWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::LeaderRouterId::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeDetachedRoleCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeChildRoleCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ChildRoleCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRouterRoleCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RouterRoleCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeLeaderRoleCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttachAttemptCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePartitionIdChangeCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBetterPartitionAttachAttemptCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeParentChangeCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ParentChangeCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxTotalCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxTotalCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxUnicastCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxUnicastCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxBroadcastCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxAckRequestedCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxAckedCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxAckedCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxNoAckRequestedCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxDataCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxDataCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxDataPollCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxDataPollCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxBeaconCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxBeaconCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxBeaconRequestCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxOtherCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxOtherCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxRetryCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxRetryCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxDirectMaxRetryExpiryCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxIndirectMaxRetryExpiryCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxErrCcaCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxErrAbortCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTxErrBusyChannelCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxTotalCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxTotalCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxUnicastCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxUnicastCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxBroadcastCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxDataCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxDataCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxDataPollCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxDataPollCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxBeaconCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxBeaconCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxBeaconRequestCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxOtherCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxOtherCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxAddressFilteredCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxDestAddrFilteredCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxDuplicatedCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxErrNoFrameCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxErrUnknownNeighborCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxErrInvalidSrcAddrCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxErrSecCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxErrSecCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxErrFcsCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRxErrOtherCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActiveTimestampWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePendingTimestampWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::PendingTimestamp::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeDelayWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::Delay::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSecurityPolicyWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::SecurityPolicy::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPThreadNetworkDiagnosticsClusterSecurityPolicy class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPThreadNetworkDiagnosticsClusterSecurityPolicy *) value[i_0]; - listHolder_0->mList[i_0].rotationTime = element_0.rotationTime.unsignedShortValue; - listHolder_0->mList[i_0].flags = element_0.flags.unsignedShortValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeChannelMaskWithValue:(NSData * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ChannelMask::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asByteSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeOperationalDatasetComponentsWithValue:(NSArray * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPThreadNetworkDiagnosticsClusterOperationalDatasetComponents class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPThreadNetworkDiagnosticsClusterOperationalDatasetComponents *) value[i_0]; - listHolder_0->mList[i_0].activeTimestampPresent = element_0.activeTimestampPresent.boolValue; - listHolder_0->mList[i_0].pendingTimestampPresent = element_0.pendingTimestampPresent.boolValue; - listHolder_0->mList[i_0].masterKeyPresent = element_0.masterKeyPresent.boolValue; - listHolder_0->mList[i_0].networkNamePresent = element_0.networkNamePresent.boolValue; - listHolder_0->mList[i_0].extendedPanIdPresent = element_0.extendedPanIdPresent.boolValue; - listHolder_0->mList[i_0].meshLocalPrefixPresent = element_0.meshLocalPrefixPresent.boolValue; - listHolder_0->mList[i_0].delayPresent = element_0.delayPresent.boolValue; - listHolder_0->mList[i_0].panIdPresent = element_0.panIdPresent.boolValue; - listHolder_0->mList[i_0].channelPresent = element_0.channelPresent.boolValue; - listHolder_0->mList[i_0].pskcPresent = element_0.pskcPresent.boolValue; - listHolder_0->mList[i_0].securityPolicyPresent = element_0.securityPolicyPresent.boolValue; - listHolder_0->mList[i_0].channelMaskPresent = element_0.channelMaskPresent.boolValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeActiveNetworkFaultsListWithValue:(NSArray * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] - = static_castmList[i_0])>>(element_0.unsignedCharValue); - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestTimeFormatLocalization () -@property (readonly) chip::Controller::TimeFormatLocalizationClusterTest cppCluster; -@end - -@implementation CHIPTestTimeFormatLocalization - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeSupportedCalendarTypesWithValue:(NSArray * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TimeFormatLocalization::Attributes::SupportedCalendarTypes::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] - = static_castmList[i_0])>>(element_0.unsignedCharValue); - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TimeFormatLocalization::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TimeFormatLocalization::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = TimeFormatLocalization::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestUnitLocalization () -@property (readonly) chip::Controller::UnitLocalizationClusterTest cppCluster; -@end - -@implementation CHIPTestUnitLocalization - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = UnitLocalization::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = UnitLocalization::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = UnitLocalization::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestUserLabel () -@property (readonly) chip::Controller::UserLabelClusterTest cppCluster; -@end - -@implementation CHIPTestUserLabel - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = UserLabel::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = UserLabel::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = UserLabel::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestWakeOnLan () -@property (readonly) chip::Controller::WakeOnLanClusterTest cppCluster; -@end - -@implementation CHIPTestWakeOnLan - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeMACAddressWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WakeOnLan::Attributes::MACAddress::TypeInfo; - TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WakeOnLan::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WakeOnLan::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WakeOnLan::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WakeOnLan::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestWiFiNetworkDiagnostics () -@property (readonly) chip::Controller::WiFiNetworkDiagnosticsClusterTest cppCluster; -@end - -@implementation CHIPTestWiFiNetworkDiagnostics - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeBssidWithValue:(NSData * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::Bssid::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = [self asByteSpan:value]; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSecurityTypeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::SecurityType::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = static_cast>(value.unsignedCharValue); - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeWiFiVersionWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::WiFiVersion::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = static_cast>(value.unsignedCharValue); - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeChannelNumberWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::ChannelNumber::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeRssiWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::Rssi::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.charValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBeaconLostCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::BeaconLostCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeBeaconRxCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::BeaconRxCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePacketMulticastRxCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePacketMulticastTxCountWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePacketUnicastRxCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributePacketUnicastTxCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentMaxRateWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeOverrunCountWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::OverrunCount::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedLongLongValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WiFiNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end - -@interface CHIPTestWindowCovering () -@property (readonly) chip::Controller::WindowCoveringClusterTest cppCluster; -@end - -@implementation CHIPTestWindowCovering - -- (chip::Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)writeAttributeTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::Type::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentPositionLiftWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::CurrentPositionLift::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentPositionTiltWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::CurrentPositionTilt::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeConfigStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentPositionLiftPercentageWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::CurrentPositionLiftPercentage::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentPositionTiltPercentageWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::CurrentPositionTiltPercentage::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeOperationalStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::OperationalStatus::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTargetPositionLiftPercent100thsWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::TargetPositionLiftPercent100ths::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeTargetPositionTiltPercent100thsWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::TargetPositionTiltPercent100ths::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeEndProductTypeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::EndProductType::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentPositionLiftPercent100thsWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::CurrentPositionLiftPercent100ths::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeCurrentPositionTiltPercent100thsWithValue:(NSNumber * _Nullable)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::CurrentPositionTiltPercent100ths::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedShortValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeInstalledOpenLimitLiftWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::InstalledOpenLimitLift::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeInstalledClosedLimitLiftWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::InstalledClosedLimitLift::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeInstalledOpenLimitTiltWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::InstalledOpenLimitTilt::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeInstalledClosedLimitTiltWithValue:(NSNumber * _Nonnull)value - completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::InstalledClosedLimitTilt::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeSafetyStatusWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::SafetyStatus::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::AttributeList::TypeInfo; - TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (NSNumber *) value[i_0]; - listHolder_0->mList[i_0] = element_0.unsignedIntValue; - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::FeatureMap::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = WindowCovering::Attributes::ClusterRevision::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -@end diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 50d4b8a4d56c1c..ee60eb2c7150ca 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -22,7 +22,6 @@ // module headers #import -#import #import "CHIPErrorTestUtils.h" #import "CHIPTestStorage.h" @@ -53,40 +52,6 @@ // Singleton controller we use. static CHIPDeviceController * sController = nil; -// Test Util APIs -void WaitForMs(XCTestExpectation * expectation, dispatch_queue_t queue, unsigned int ms) -{ - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, ms * NSEC_PER_MSEC), queue, ^{ - [expectation fulfill]; - }); -} - -void Log(XCTestExpectation * expectation, dispatch_queue_t queue, NSString * message) -{ - NSLog(@"%@", message); - [expectation fulfill]; -} - -// Stub for User Prompts for XCTests to run. -void UserPrompt(XCTestExpectation * expectation, dispatch_queue_t queue, NSString * message) { [expectation fulfill]; } - -// Stub for reboot target device. -void Reboot(XCTestExpectation * expectation, dispatch_queue_t queue, uint16_t discriminator) { [expectation fulfill]; } - -void WaitForCommissionee(XCTestExpectation * expectation, dispatch_queue_t queue, uint64_t deviceId) -{ - CHIPDeviceController * controller = sController; - XCTAssertNotNil(controller); - - [controller getConnectedDevice:deviceId - queue:dispatch_get_main_queue() - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [expectation fulfill]; - mConnectedDevice = device; - }]; -} - CHIPDevice * GetConnectedDevice(void) { XCTAssertNotNil(mConnectedDevice); @@ -246,48462 +211,4 @@ - (void)testReuseChipClusterObject [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestAccessControlCluster_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for commissionee"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write entries"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:0U]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; - - temp_3[1] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = [NSNumber numberWithUnsignedInt:1UL]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).endpoint = nil; - ((CHIPAccessControlClusterTarget *) temp_3[1]).deviceType = nil; - - temp_3[2] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = [NSNumber numberWithUnsignedInt:2UL]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:3U]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).deviceType = nil; - - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = temp_3; - } - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedLongLong:4ULL]; - temp_3[1] = [NSNumber numberWithUnsignedLongLong:5ULL]; - temp_3[2] = [NSNumber numberWithUnsignedLongLong:6ULL]; - temp_3[3] = [NSNumber numberWithUnsignedLongLong:7ULL]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; - } - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:8U]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; - - temp_3[1] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = [NSNumber numberWithUnsignedInt:9UL]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).endpoint = nil; - ((CHIPAccessControlClusterTarget *) temp_3[1]).deviceType = nil; - - temp_3[2] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = [NSNumber numberWithUnsignedInt:10UL]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:11U]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).deviceType = nil; - - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; - } - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[2] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).privilege = [NSNumber numberWithUnsignedChar:3]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).authMode = [NSNumber numberWithUnsignedChar:3]; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedLongLong:12ULL]; - temp_3[1] = [NSNumber numberWithUnsignedLongLong:13ULL]; - temp_3[2] = [NSNumber numberWithUnsignedLongLong:14ULL]; - temp_3[3] = [NSNumber numberWithUnsignedLongLong:15ULL]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).subjects = temp_3; - } - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:16U]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; - - temp_3[1] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = [NSNumber numberWithUnsignedInt:17UL]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).endpoint = nil; - ((CHIPAccessControlClusterTarget *) temp_3[1]).deviceType = nil; - - temp_3[2] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = [NSNumber numberWithUnsignedInt:18UL]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:19U]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).deviceType = nil; - - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).targets = temp_3; - } - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write entries Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 3); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets count], 3); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[0]) - .cluster - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[0]) - .endpoint - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[0]).endpoint unsignedShortValue], - 0U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[0]) - .deviceType - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[1]) - .cluster - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[1]).cluster unsignedIntValue], - 1UL); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[1]) - .endpoint - == nil); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[1]) - .deviceType - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]) - .cluster - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]).cluster unsignedIntValue], - 2UL); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]) - .endpoint - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]).endpoint unsignedShortValue], - 3U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]) - .deviceType - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).privilege unsignedCharValue], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).authMode unsignedCharValue], 2); - XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects == nil); - XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects count], 4); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[0] unsignedLongLongValue], - 4ULL); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[1] unsignedLongLongValue], - 5ULL); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[2] unsignedLongLongValue], - 6ULL); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[3] unsignedLongLongValue], - 7ULL); - XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets == nil); - XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets count], 3); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]) - .cluster - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]) - .endpoint - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]).endpoint unsignedShortValue], - 8U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]) - .deviceType - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[1]) - .cluster - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[1]).cluster unsignedIntValue], - 9UL); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[1]) - .endpoint - == nil); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[1]) - .deviceType - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[2]) - .cluster - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[2]).cluster unsignedIntValue], - 10UL); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[2]) - .endpoint - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[2]).endpoint unsignedShortValue], - 11U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[2]) - .deviceType - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex unsignedCharValue], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).privilege unsignedCharValue], 3); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).authMode unsignedCharValue], 3); - XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects == nil); - XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects count], 4); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects[0] unsignedLongLongValue], - 12ULL); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects[1] unsignedLongLongValue], - 13ULL); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects[2] unsignedLongLongValue], - 14ULL); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects[3] unsignedLongLongValue], - 15ULL); - XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).targets == nil); - XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).targets count], 3); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[0]) - .cluster - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[0]) - .endpoint - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[0]).endpoint unsignedShortValue], - 16U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[0]) - .deviceType - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[1]) - .cluster - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[1]).cluster unsignedIntValue], - 17UL); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[1]) - .endpoint - == nil); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[1]) - .deviceType - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[2]) - .cluster - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[2]).cluster unsignedIntValue], - 18UL); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[2]) - .endpoint - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[2]).endpoint unsignedShortValue], - 19U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) - .targets[2]) - .deviceType - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000003_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write entries empty lists"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; - } - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; - } - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write entries empty lists Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 2); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).privilege unsignedCharValue], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000005_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry invalid privilege"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:3]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write entry invalid privilege Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000007_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry invalid auth mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:1]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write entry invalid auth mode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000009_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry invalid subject"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedLongLong:0ULL]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; - } - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write entry invalid subject Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000011_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry invalid target"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; - - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; - } - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write entry invalid target Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000013_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry too many subjects"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedLongLong:1ULL]; - temp_3[1] = [NSNumber numberWithUnsignedLongLong:2ULL]; - temp_3[2] = [NSNumber numberWithUnsignedLongLong:3ULL]; - temp_3[3] = [NSNumber numberWithUnsignedLongLong:4ULL]; - temp_3[4] = [NSNumber numberWithUnsignedLongLong:5ULL]; - temp_3[5] = [NSNumber numberWithUnsignedLongLong:6ULL]; - temp_3[6] = [NSNumber numberWithUnsignedLongLong:7ULL]; - temp_3[7] = [NSNumber numberWithUnsignedLongLong:8ULL]; - temp_3[8] = [NSNumber numberWithUnsignedLongLong:9ULL]; - temp_3[9] = [NSNumber numberWithUnsignedLongLong:10ULL]; - temp_3[10] = [NSNumber numberWithUnsignedLongLong:11ULL]; - temp_3[11] = [NSNumber numberWithUnsignedLongLong:12ULL]; - temp_3[12] = [NSNumber numberWithUnsignedLongLong:13ULL]; - temp_3[13] = [NSNumber numberWithUnsignedLongLong:14ULL]; - temp_3[14] = [NSNumber numberWithUnsignedLongLong:15ULL]; - temp_3[15] = [NSNumber numberWithUnsignedLongLong:16ULL]; - temp_3[16] = [NSNumber numberWithUnsignedLongLong:17ULL]; - temp_3[17] = [NSNumber numberWithUnsignedLongLong:18ULL]; - temp_3[18] = [NSNumber numberWithUnsignedLongLong:19ULL]; - temp_3[19] = [NSNumber numberWithUnsignedLongLong:20ULL]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; - } - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write entry too many subjects Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000015_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry too many targets"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:1U]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; - - temp_3[1] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[1]).endpoint = [NSNumber numberWithUnsignedShort:2U]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).deviceType = nil; - - temp_3[2] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:3U]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).deviceType = nil; - - temp_3[3] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[3]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[3]).endpoint = [NSNumber numberWithUnsignedShort:4U]; - ((CHIPAccessControlClusterTarget *) temp_3[3]).deviceType = nil; - - temp_3[4] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[4]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[4]).endpoint = [NSNumber numberWithUnsignedShort:5U]; - ((CHIPAccessControlClusterTarget *) temp_3[4]).deviceType = nil; - - temp_3[5] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[5]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[5]).endpoint = [NSNumber numberWithUnsignedShort:6U]; - ((CHIPAccessControlClusterTarget *) temp_3[5]).deviceType = nil; - - temp_3[6] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[6]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[6]).endpoint = [NSNumber numberWithUnsignedShort:7U]; - ((CHIPAccessControlClusterTarget *) temp_3[6]).deviceType = nil; - - temp_3[7] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[7]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[7]).endpoint = [NSNumber numberWithUnsignedShort:8U]; - ((CHIPAccessControlClusterTarget *) temp_3[7]).deviceType = nil; - - temp_3[8] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[8]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[8]).endpoint = [NSNumber numberWithUnsignedShort:9U]; - ((CHIPAccessControlClusterTarget *) temp_3[8]).deviceType = nil; - - temp_3[9] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[9]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[9]).endpoint = [NSNumber numberWithUnsignedShort:10U]; - ((CHIPAccessControlClusterTarget *) temp_3[9]).deviceType = nil; - - temp_3[10] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[10]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[10]).endpoint = [NSNumber numberWithUnsignedShort:11U]; - ((CHIPAccessControlClusterTarget *) temp_3[10]).deviceType = nil; - - temp_3[11] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[11]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[11]).endpoint = [NSNumber numberWithUnsignedShort:12U]; - ((CHIPAccessControlClusterTarget *) temp_3[11]).deviceType = nil; - - temp_3[12] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[12]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[12]).endpoint = [NSNumber numberWithUnsignedShort:13U]; - ((CHIPAccessControlClusterTarget *) temp_3[12]).deviceType = nil; - - temp_3[13] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[13]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[13]).endpoint = [NSNumber numberWithUnsignedShort:14U]; - ((CHIPAccessControlClusterTarget *) temp_3[13]).deviceType = nil; - - temp_3[14] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[14]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[14]).endpoint = [NSNumber numberWithUnsignedShort:15U]; - ((CHIPAccessControlClusterTarget *) temp_3[14]).deviceType = nil; - - temp_3[15] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[15]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[15]).endpoint = [NSNumber numberWithUnsignedShort:16U]; - ((CHIPAccessControlClusterTarget *) temp_3[15]).deviceType = nil; - - temp_3[16] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[16]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[16]).endpoint = [NSNumber numberWithUnsignedShort:17U]; - ((CHIPAccessControlClusterTarget *) temp_3[16]).deviceType = nil; - - temp_3[17] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[17]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[17]).endpoint = [NSNumber numberWithUnsignedShort:18U]; - ((CHIPAccessControlClusterTarget *) temp_3[17]).deviceType = nil; - - temp_3[18] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[18]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[18]).endpoint = [NSNumber numberWithUnsignedShort:19U]; - ((CHIPAccessControlClusterTarget *) temp_3[18]).deviceType = nil; - - temp_3[19] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[19]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[19]).endpoint = [NSNumber numberWithUnsignedShort:20U]; - ((CHIPAccessControlClusterTarget *) temp_3[19]).deviceType = nil; - - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; - } - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write entry too many targets Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000017_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Restore ACL"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - aclArgument = temp_0; - } - [cluster writeAttributeAclWithValue:aclArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Restore ACL Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeAclWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000019_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate resource minima (SubjectsPerAccessControlEntry)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeSubjectsPerAccessControlEntryWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate resource minima (SubjectsPerAccessControlEntry) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 4U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate resource minima (TargetsPerAccessControlEntry)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTargetsPerAccessControlEntryWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate resource minima (TargetsPerAccessControlEntry) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 3U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestAccessControlCluster_000021_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate resource minima (AccessControlEntriesPerFabric)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeAccessControlEntriesPerFabricWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate resource minima (AccessControlEntriesPerFabric) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 3U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_BI_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_BI_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_1_1_000003_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_1_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic 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_BI_1_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic 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_BI_1_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic 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_BI_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_BI_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read mandatory non-global attribute: OutOfService"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOutOfServiceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read mandatory non-global attribute: OutOfService Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read mandatory non-global attribute constraints: OutOfService"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOutOfServiceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read mandatory non-global attribute constraints: OutOfService Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000003_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory non-global attribute: OutOfService"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id outOfServiceArgument; - outOfServiceArgument = [NSNumber numberWithBool:0]; - [cluster - writeAttributeOutOfServiceWithValue:outOfServiceArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory non-global attribute: OutOfService Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back the mandatory non-global attribute: OutOfService"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOutOfServiceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back the mandatory non-global attribute: OutOfService Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read mandatory non-global attribute constraints: PresentValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePresentValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read mandatory non-global attribute constraints: PresentValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000006_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory non-global attribute: PresentValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id presentValueArgument; - presentValueArgument = [NSNumber numberWithBool:0]; - [cluster - writeAttributePresentValueWithValue:presentValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory non-global attribute: PresentValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back the mandatory non-global attribute: PresentValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePresentValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back the mandatory non-global attribute: PresentValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read mandatory non-global attribute: StatusFlags"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusFlagsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read mandatory non-global attribute: StatusFlags Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read mandatory non-global attribute constraints: StatusFlags"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusFlagsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read mandatory non-global attribute constraints: StatusFlags 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], 15); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000010_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory non-global attribute: StatusFlags"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id statusFlagsArgument; - statusFlagsArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeStatusFlagsWithValue:statusFlagsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory non-global attribute: StatusFlags Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back the mandatory non-global attribute: StatusFlags"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusFlagsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back the mandatory non-global attribute: StatusFlags Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_BI_2_2_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_BI_2_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads PresentValue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePresentValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads PresentValue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OutOfService attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOutOfServiceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OutOfService attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads StatusFlags attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusFlagsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads StatusFlags attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_2_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads PresentValue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePresentValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads PresentValue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_2_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OutOfService attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOutOfServiceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OutOfService attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads StatusFlags attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusFlagsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads StatusFlags attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_2_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads StatusFlags attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusFlagsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads StatusFlags attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BI_2_2_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads StatusFlags attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusFlagsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads StatusFlags attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_BOOL_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_BOOL_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read mandatory non-global attribute: StateValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStateValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read mandatory non-global attribute: StateValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BOOL_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read mandatory non-global attribute constraints: StateValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStateValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read mandatory non-global attribute constraints: StateValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_BRAC_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_BRAC_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BRAC_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_BRAC_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions 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_BRAC_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions 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_BRAC_1_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions 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_CC_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_CC_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: current hue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: current hue 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], 254); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default value to mandatory attribute: CurrentHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentHueArgument; - currentHueArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeCurrentHueWithValue:currentHueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default value to mandatory attribute: CurrentHue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: CurrentHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: CurrentHue 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], 254); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: CurrentSaturation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentSaturationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: CurrentSaturation 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], 254); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000005_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default value to mandatory attribute: CurrentSaturation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentSaturationArgument; - currentSaturationArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeCurrentSaturationWithValue:currentSaturationArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default value to mandatory attribute: CurrentSaturation Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: CurrentSaturation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentSaturationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: CurrentSaturation 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], 254); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: CurrentX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: CurrentX 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000008_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default value to mandatory attribute: CurrentX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentXArgument; - currentXArgument = [NSNumber numberWithUnsignedShort:24939U]; - [cluster writeAttributeCurrentXWithValue:currentXArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default value to mandatory attribute: CurrentX Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: CurrentX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: CurrentX 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: CurrentY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: CurrentY 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000011_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: CurrentY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentYArgument; - currentYArgument = [NSNumber numberWithUnsignedShort:24701U]; - [cluster writeAttributeCurrentYWithValue:currentYArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: CurrentY Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: CurrentY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: CurrentY 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: ColorTemperatureMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorTemperatureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorTemperatureMireds 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ColorMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorMode 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_CC_2_1_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: Options"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorControlOptionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: Options Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000016_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default values to mandatory attribute: Options"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorControlOptionsArgument; - colorControlOptionsArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeColorControlOptionsWithValue:colorControlOptionsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: Options Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: Options"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorControlOptionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: Options Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: EnhancedCurrentHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: EnhancedCurrentHue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000019_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: EnhancedCurrentHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enhancedCurrentHueArgument; - enhancedCurrentHueArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster - writeAttributeEnhancedCurrentHueWithValue:enhancedCurrentHueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: EnhancedCurrentHue Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: EnhancedCurrentHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: EnhancedCurrentHue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000021_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: EnhancedColorMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedColorModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: EnhancedColorMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000022_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ColorLoopActive"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorLoopActive Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000023_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: ColorLoopActive"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorLoopActiveArgument; - colorLoopActiveArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeColorLoopActiveWithValue:colorLoopActiveArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: ColorLoopActive Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000024_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: ColorLoopActive"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: ColorLoopActive Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000025_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ColorLoopDirection"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorLoopDirection Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000026_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: ColorLoopDirection"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorLoopDirectionArgument; - colorLoopDirectionArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeColorLoopDirectionWithValue:colorLoopDirectionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: ColorLoopDirection Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000027_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: ColorLoopDirection"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: ColorLoopDirection Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000028_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ColorLoopTime"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorLoopTime Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000029_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: ColorLoopTime"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorLoopTimeArgument; - colorLoopTimeArgument = [NSNumber numberWithUnsignedShort:25U]; - [cluster - writeAttributeColorLoopTimeWithValue:colorLoopTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: ColorLoopTime Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000030_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: ColorLoopTime"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: ColorLoopTime Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000031_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: ColorLoopStartEnhancedHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStartEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorLoopStartEnhancedHue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000032_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: ColorLoopStartEnhancedHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorLoopStartEnhancedHueArgument; - colorLoopStartEnhancedHueArgument = [NSNumber numberWithUnsignedShort:8960U]; - [cluster writeAttributeColorLoopStartEnhancedHueWithValue:colorLoopStartEnhancedHueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: ColorLoopStartEnhancedHue " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000033_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back mandatory attribute: ColorLoopStartEnhancedHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStartEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: ColorLoopStartEnhancedHue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000034_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: ColorLoopStoredEnhancedHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorLoopStoredEnhancedHue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000035_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: ColorLoopStoredEnhancedHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorLoopStoredEnhancedHueArgument; - colorLoopStoredEnhancedHueArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeColorLoopStoredEnhancedHueWithValue:colorLoopStoredEnhancedHueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: " - @"ColorLoopStoredEnhancedHue Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000036_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back mandatory attribute: ColorLoopStoredEnhancedHue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: ColorLoopStoredEnhancedHue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000037_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ColorCapabilities"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorCapabilitiesWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorCapabilities 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], 31U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000038_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: ColorCapabilities"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorCapabilitiesArgument; - colorCapabilitiesArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster - writeAttributeColorCapabilitiesWithValue:colorCapabilitiesArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: ColorCapabilities Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000039_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: ColorCapabilities"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorCapabilitiesWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: ColorCapabilities 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], 31U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000040_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: ColorTempPhysicalMinMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorTempPhysicalMinWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorTempPhysicalMinMireds 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000041_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: ColorTempPhysicalMinMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorTempPhysicalMinArgument; - colorTempPhysicalMinArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster - writeAttributeColorTempPhysicalMinWithValue:colorTempPhysicalMinArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"Write the default values to mandatory attribute: ColorTempPhysicalMinMireds Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000042_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back mandatory attribute: ColorTempPhysicalMinMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorTempPhysicalMinWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: ColorTempPhysicalMinMireds 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000043_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: ColorTempPhysicalMaxMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorTempPhysicalMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ColorTempPhysicalMaxMireds 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000044_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: ColorTempPhysicalMaxMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorTempPhysicalMaxArgument; - colorTempPhysicalMaxArgument = [NSNumber numberWithUnsignedShort:65279U]; - [cluster - writeAttributeColorTempPhysicalMaxWithValue:colorTempPhysicalMaxArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"Write the default values to mandatory attribute: ColorTempPhysicalMaxMireds Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000045_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back mandatory attribute: ColorTempPhysicalMaxMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorTempPhysicalMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: ColorTempPhysicalMaxMireds 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000046_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read the optional attribute: CoupleColorTempToLevelMinMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCoupleColorTempToLevelMinMiredsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: CoupleColorTempToLevelMinMireds Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000047_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to optional attribute: CoupleColorTempToLevelMinMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id coupleColorTempToLevelMinMiredsArgument; - coupleColorTempToLevelMinMiredsArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeCoupleColorTempToLevelMinMiredsWithValue:coupleColorTempToLevelMinMiredsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to optional attribute: " - @"CoupleColorTempToLevelMinMireds Error: %@", - err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000048_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back optional attribute: CoupleColorTempToLevelMinMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCoupleColorTempToLevelMinMiredsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back optional attribute: CoupleColorTempToLevelMinMireds Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000049_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read the optional attribute: StartUpColorTemperatureMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeStartUpColorTemperatureMiredsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: StartUpColorTemperatureMireds Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000050_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to optional attribute: StartUpColorTemperatureMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id startUpColorTemperatureMiredsArgument; - startUpColorTemperatureMiredsArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeStartUpColorTemperatureMiredsWithValue:startUpColorTemperatureMiredsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to optional attribute: " - @"StartUpColorTemperatureMireds Error: %@", - err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000051_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back optional attribute: StartUpColorTemperatureMireds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeStartUpColorTemperatureMiredsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back optional attribute: StartUpColorTemperatureMireds Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000052_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RemainingTime"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRemainingTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RemainingTime Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000053_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to optional attribute: RemainingTime"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id remainingTimeArgument; - remainingTimeArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster - writeAttributeRemainingTimeWithValue:remainingTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to optional attribute: RemainingTime Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000054_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back optional attribute: RemainingTime"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRemainingTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back optional attribute: RemainingTime Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000055_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: DriftCompensation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDriftCompensationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: DriftCompensation Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 4); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000056_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to optional attribute: DriftCompensation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id driftCompensationArgument; - driftCompensationArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeDriftCompensationWithValue:driftCompensationArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to optional attribute: DriftCompensation Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000057_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back optional attribute: DriftCompensation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDriftCompensationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back optional attribute: DriftCompensation Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 4); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000058_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: CompensationText"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCompensationTextWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: CompensationText Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000059_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to optional attribute: CompensationText"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id compensationTextArgument; - compensationTextArgument = @""; - [cluster - writeAttributeCompensationTextWithValue:compensationTextArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to optional attribute: CompensationText Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000060_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back optional attribute: CompensationText"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCompensationTextWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back optional attribute: CompensationText Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000061_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: NumberOfPrimaries"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNumberOfPrimariesWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: NumberOfPrimaries 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], 6); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000062_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: NumberOfPrimaries"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id numberOfPrimariesArgument; - numberOfPrimariesArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeNumberOfPrimariesWithValue:numberOfPrimariesArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: NumberOfPrimaries Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000063_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: NumberOfPrimaries"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNumberOfPrimariesWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: NumberOfPrimaries 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], 6); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000064_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary1X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary1XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary1X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000065_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary1X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary1XArgument; - primary1XArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary1XWithValue:primary1XArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary1X Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000066_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary1X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary1XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary1X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000067_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary1Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary1YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary1Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000068_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary1Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary1YArgument; - primary1YArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary1YWithValue:primary1YArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary1Y Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000069_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary1Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary1YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary1Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000070_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary1Intensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary1IntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary1Intensity Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000071_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary2X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary2XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary2X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000072_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary2X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary2XArgument; - primary2XArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary2XWithValue:primary2XArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary2X Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000073_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary2X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary2XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary2X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000074_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary2Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary2YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary2Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000075_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary2Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary2YArgument; - primary2YArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary2YWithValue:primary2YArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary2Y Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000076_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary2Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary2YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary2Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000077_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: Primary2Intensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary2IntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: Primary2Intensity Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000078_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary3X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary3XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary3X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000079_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary3X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary3XArgument; - primary3XArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary3XWithValue:primary3XArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary3X Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000080_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary3X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary3XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary3X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000081_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary3Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary3YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary3Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000082_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary3Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary3YArgument; - primary3YArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary3YWithValue:primary3YArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary3Y Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000083_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary3Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary3YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary3Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000084_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary3Intensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary3IntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary3Intensity Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000085_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary4X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary4XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary4X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000086_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary4X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary4XArgument; - primary4XArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary4XWithValue:primary4XArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary4X Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000087_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary4X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary4XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary4X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000088_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary4Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary4YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary4Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000089_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary4Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary4YArgument; - primary4YArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary4YWithValue:primary4YArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary4Y Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000090_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary4Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary4YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary4Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000091_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary4Intensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary4IntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary4Intensity Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000092_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary5X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary5XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary5X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000093_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary5X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary5XArgument; - primary5XArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary5XWithValue:primary5XArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary5X Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000094_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary5X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary5XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary5X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000095_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary5Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary5YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary5Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000096_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary5Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary5YArgument; - primary5YArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary5YWithValue:primary5YArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary5Y Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000097_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary5Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary5YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary5Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000098_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary5Intensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary5IntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary5Intensity Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000099_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary6X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary6XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary6X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000100_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary6X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary6XArgument; - primary6XArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary6XWithValue:primary6XArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary6X Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000101_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary6X"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary6XWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary6X 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000102_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary6Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary6YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary6Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000103_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default mandatory attribute: Primary6Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id primary6YArgument; - primary6YArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributePrimary6YWithValue:primary6YArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default mandatory attribute: Primary6Y Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000104_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the mandatory attribute: Primary6Y"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary6YWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the mandatory attribute: Primary6Y 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000105_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: Primary6Intensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePrimary6IntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: Primary6Intensity Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000106_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: WhitePointX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeWhitePointXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: WhitePointX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000107_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default optional attribute: WhitePointX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id whitePointXArgument; - whitePointXArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeWhitePointXWithValue:whitePointXArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: WhitePointX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000108_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: WhitePointX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeWhitePointXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: WhitePointX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000109_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: WhitePointY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeWhitePointYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: WhitePointY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000110_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default optional attribute: WhitePointY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id whitePointYArgument; - whitePointYArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeWhitePointYWithValue:whitePointYArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: WhitePointY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000111_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: WhitePointY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeWhitePointYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: WhitePointY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000112_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointRX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointRXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointRX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000113_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default optional attribute: ColorPointRX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointRXArgument; - colorPointRXArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeColorPointRXWithValue:colorPointRXArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointRX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000114_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointRX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointRXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointRX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000115_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointRY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointRYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointRY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000116_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default optional attribute: ColorPointRY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointRYArgument; - colorPointRYArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeColorPointRYWithValue:colorPointRYArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointRY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000117_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointRY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointRYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointRY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000118_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointRIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointRIntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointRIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000119_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default optional attribute: ColorPointRIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointRIntensityArgument; - colorPointRIntensityArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeColorPointRIntensityWithValue:colorPointRIntensityArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointRIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000120_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointRIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointRIntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointRIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000121_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointGX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointGXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointGX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000122_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default optional attribute: ColorPointGX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointGXArgument; - colorPointGXArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeColorPointGXWithValue:colorPointGXArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointGX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000123_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointGX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointGXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointGX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000124_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointGY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointGYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointGY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000125_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default optional attribute: ColorPointGY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointGYArgument; - colorPointGYArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeColorPointGYWithValue:colorPointGYArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointGY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000126_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointGY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointGYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointGY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000127_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointGIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointGIntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointGIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000128_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default optional attribute: ColorPointGIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointGIntensityArgument; - colorPointGIntensityArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeColorPointGIntensityWithValue:colorPointGIntensityArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointGIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000129_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointGIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointGIntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointGIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000130_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointBX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointBXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointBX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000131_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default optional attribute: ColorPointBX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointBXArgument; - colorPointBXArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeColorPointBXWithValue:colorPointBXArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointBX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000132_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointBX"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointBXWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointBX Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000133_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointBY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointBYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointBY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000134_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write the default optional attribute: ColorPointBY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointBYArgument; - colorPointBYArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeColorPointBYWithValue:colorPointBYArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointBY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000135_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointBY"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointBYWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointBY Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000136_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional attribute: ColorPointBIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointBIntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute: ColorPointBIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000137_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default optional attribute: ColorPointBIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id colorPointBIntensityArgument; - colorPointBIntensityArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeColorPointBIntensityWithValue:colorPointBIntensityArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default optional attribute: ColorPointBIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_2_1_000138_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back the optional attribute: ColorPointBIntensity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorPointBIntensityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back the optional attribute: ColorPointBIntensity Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_3_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_CC_3_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentHue attribute from 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], 254); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_1_000004_MoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move to hue shortest distance command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveToHueParams alloc] init]; - params.hue = [NSNumber numberWithUnsignedChar:150]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.transitionTime = [NSNumber numberWithUnsignedShort:300U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move to hue shortest distance command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_1_000005_MoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move to hue longest distance command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveToHueParams alloc] init]; - params.hue = [NSNumber numberWithUnsignedChar:200]; - params.direction = [NSNumber numberWithUnsignedChar:1]; - params.transitionTime = [NSNumber numberWithUnsignedShort:300U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move to hue longest distance command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_1_000006_MoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move to hue up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveToHueParams alloc] init]; - params.hue = [NSNumber numberWithUnsignedChar:250]; - params.direction = [NSNumber numberWithUnsignedChar:2]; - params.transitionTime = [NSNumber numberWithUnsignedShort:300U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move to hue up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_1_000007_MoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move to hue down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveToHueParams alloc] init]; - params.hue = [NSNumber numberWithUnsignedChar:225]; - params.direction = [NSNumber numberWithUnsignedChar:3]; - params.transitionTime = [NSNumber numberWithUnsignedShort:300U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move to hue down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_1_000008_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_3_2_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_CC_3_2_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_2_000003_MoveHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move hue up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveHueParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedChar:50]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move hue up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_2_000004_MoveHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move hue stop command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveHueParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:50]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move hue stop command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_2_000005_MoveHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move hue down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveHueParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:3]; - params.rate = [NSNumber numberWithUnsignedChar:50]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move hue down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_2_000006_MoveHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move hue stop command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveHueParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:50]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move hue stop command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_2_000007_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_2_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_3_3_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_CC_3_3_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_3_000003_StepHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step hue up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterStepHueParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedChar:5]; - params.transitionTime = [NSNumber numberWithUnsignedChar:25]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Step hue up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_3_000004_StepHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step hue down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterStepHueParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:3]; - params.stepSize = [NSNumber numberWithUnsignedChar:5]; - params.transitionTime = [NSNumber numberWithUnsignedChar:25]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Step hue down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_3_000005_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_3_3_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_4_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_CC_4_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_1_000003_MoveToSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move to saturation command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveToSaturationParams alloc] init]; - params.saturation = [NSNumber numberWithUnsignedChar:90]; - params.transitionTime = [NSNumber numberWithUnsignedShort:10U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveToSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move to saturation command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_1_000004_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_4_2_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_CC_4_2_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000003_MoveSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move saturation up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveSaturationParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedChar:5]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move saturation up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000004_MoveSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move saturation down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveSaturationParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:3]; - params.rate = [NSNumber numberWithUnsignedChar:5]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move saturation down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000005_MoveSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move saturation up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveSaturationParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedChar:5]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move saturation up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000006_MoveSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move saturation stop command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveSaturationParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:5]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move saturation stop command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000007_MoveSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move saturation down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveSaturationParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:3]; - params.rate = [NSNumber numberWithUnsignedChar:5]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move saturation down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000008_MoveSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move saturation stop command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveSaturationParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:5]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move saturation stop command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000009_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_2_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_4_3_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_CC_4_3_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_3_000003_StepSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step saturation up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterStepSaturationParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedChar:15]; - params.transitionTime = [NSNumber numberWithUnsignedChar:10]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Step saturation up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_3_000004_StepSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step saturation down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterStepSaturationParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:3]; - params.stepSize = [NSNumber numberWithUnsignedChar:20]; - params.transitionTime = [NSNumber numberWithUnsignedChar:10]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Step saturation down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_3_000005_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_3_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_4_4_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_CC_4_4_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_4_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_4_000003_MoveToHueAndSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move To current hue and saturation command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveToHueAndSaturationParams alloc] init]; - params.hue = [NSNumber numberWithUnsignedChar:40]; - params.saturation = [NSNumber numberWithUnsignedChar:160]; - params.transitionTime = [NSNumber numberWithUnsignedShort:10U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveToHueAndSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move To current hue and saturation command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_4_000004_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_4_4_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_5_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_CC_5_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_1_000003_MoveToColor -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move to Color command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveToColorParams alloc] init]; - params.colorX = [NSNumber numberWithUnsignedShort:200U]; - params.colorY = [NSNumber numberWithUnsignedShort:300U]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveToColorWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move to Color command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_1_000004_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_5_2_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_CC_5_2_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_2_000003_MoveColor -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move Color command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveColorParams alloc] init]; - params.rateX = [NSNumber numberWithShort:15]; - params.rateY = [NSNumber numberWithShort:20]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveColorWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move Color command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_2_000004_StopMoveStep -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Stop Move Step command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterStopMoveStepParams alloc] init]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stopMoveStepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Stop Move Step command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_2_000005_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_5_3_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_CC_5_3_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_3_000003_StepColor -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step Color command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterStepColorParams alloc] init]; - params.stepX = [NSNumber numberWithShort:15]; - params.stepY = [NSNumber numberWithShort:20]; - params.transitionTime = [NSNumber numberWithUnsignedShort:50U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepColorWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Step Color command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_3_000004_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_5_3_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_6_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_CC_6_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_1_000003_MoveToColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move To Color Temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveToColorTemperatureParams alloc] init]; - params.colorTemperature = [NSNumber numberWithUnsignedShort:100U]; - params.transitionTime = [NSNumber numberWithUnsignedShort:10U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveToColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move To Color Temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_1_000004_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_6_2_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_CC_6_2_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read current color temprature"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorTemperatureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read current color temprature 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], 65279U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000004_MoveColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move up color temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveColorTemperatureParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedShort:10U]; - params.colorTemperatureMinimum = [NSNumber numberWithUnsignedShort:1U]; - params.colorTemperatureMaximum = [NSNumber numberWithUnsignedShort:255U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move up color temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000005_MoveColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move down color temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveColorTemperatureParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:3]; - params.rate = [NSNumber numberWithUnsignedShort:20U]; - params.colorTemperatureMinimum = [NSNumber numberWithUnsignedShort:1U]; - params.colorTemperatureMaximum = [NSNumber numberWithUnsignedShort:255U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move down color temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000006_MoveColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move up color temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveColorTemperatureParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedShort:10U]; - params.colorTemperatureMinimum = [NSNumber numberWithUnsignedShort:1U]; - params.colorTemperatureMaximum = [NSNumber numberWithUnsignedShort:255U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move up color temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000007_MoveColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Stop Color Temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveColorTemperatureParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedShort:10U]; - params.colorTemperatureMinimum = [NSNumber numberWithUnsignedShort:1U]; - params.colorTemperatureMaximum = [NSNumber numberWithUnsignedShort:255U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Stop Color Temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000008_MoveColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Move down color temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveColorTemperatureParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:3]; - params.rate = [NSNumber numberWithUnsignedShort:20U]; - params.colorTemperatureMinimum = [NSNumber numberWithUnsignedShort:1U]; - params.colorTemperatureMaximum = [NSNumber numberWithUnsignedShort:255U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Move down color temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000009_MoveColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Stop Color Temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterMoveColorTemperatureParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedShort:10U]; - params.colorTemperatureMinimum = [NSNumber numberWithUnsignedShort:1U]; - params.colorTemperatureMaximum = [NSNumber numberWithUnsignedShort:255U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster moveColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Stop Color Temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000010_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_2_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_6_3_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_CC_6_3_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_3_000003_StepColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step up color temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterStepColorTemperatureParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedShort:5U]; - params.transitionTime = [NSNumber numberWithUnsignedShort:50U]; - params.colorTemperatureMinimum = [NSNumber numberWithUnsignedShort:5U]; - params.colorTemperatureMaximum = [NSNumber numberWithUnsignedShort:100U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Step up color temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_3_000004_StepColorTemperature -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step down color temperature command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterStepColorTemperatureParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:3]; - params.stepSize = [NSNumber numberWithUnsignedShort:5U]; - params.transitionTime = [NSNumber numberWithUnsignedShort:50U]; - params.colorTemperatureMinimum = [NSNumber numberWithUnsignedShort:5U]; - params.colorTemperatureMaximum = [NSNumber numberWithUnsignedShort:100U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepColorTemperatureWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Step down color temperature command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_3_000005_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_6_3_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_7_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_CC_7_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_1_000003_EnhancedMoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveToHueParams alloc] init]; - params.enhancedHue = [NSNumber numberWithUnsignedShort:1025U]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.transitionTime = [NSNumber numberWithUnsignedShort:1U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move To Hue command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_1_000004_EnhancedMoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveToHueParams alloc] init]; - params.enhancedHue = [NSNumber numberWithUnsignedShort:1100U]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.transitionTime = [NSNumber numberWithUnsignedShort:300U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move To Hue command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_1_000005_EnhancedMoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveToHueParams alloc] init]; - params.enhancedHue = [NSNumber numberWithUnsignedShort:1150U]; - params.direction = [NSNumber numberWithUnsignedChar:1]; - params.transitionTime = [NSNumber numberWithUnsignedShort:300U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move To Hue command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_1_000006_EnhancedMoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveToHueParams alloc] init]; - params.enhancedHue = [NSNumber numberWithUnsignedShort:1200U]; - params.direction = [NSNumber numberWithUnsignedChar:2]; - params.transitionTime = [NSNumber numberWithUnsignedShort:300U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move To Hue command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_1_000007_EnhancedMoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveToHueParams alloc] init]; - params.enhancedHue = [NSNumber numberWithUnsignedShort:1300U]; - params.direction = [NSNumber numberWithUnsignedChar:3]; - params.transitionTime = [NSNumber numberWithUnsignedShort:300U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move To Hue command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_1_000008_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_7_2_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_CC_7_2_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check EnhancedCurrentHue 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_2_000004_EnhancedMoveHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move Hue Up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveHueParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedShort:50U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move Hue Up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_2_000005_EnhancedMoveHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move Hue Stop command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveHueParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move Hue Stop command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_2_000006_EnhancedMoveHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move Hue Down command "]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveHueParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:3]; - params.rate = [NSNumber numberWithUnsignedShort:5U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move Hue Down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_2_000007_EnhancedMoveHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move Hue Stop command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveHueParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move Hue Stop command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_2_000008_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_2_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_7_3_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_CC_7_3_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_3_000003_EnhancedStepHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Step Hue Up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedStepHueParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:0]; - params.stepSize = [NSNumber numberWithUnsignedShort:50U]; - params.transitionTime = [NSNumber numberWithUnsignedShort:1U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedStepHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Step Hue Up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_3_000004_EnhancedStepHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Step Hue Down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedStepHueParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedShort:75U]; - params.transitionTime = [NSNumber numberWithUnsignedShort:1U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedStepHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Step Hue Down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_3_000005_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_3_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_7_4_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_CC_7_4_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_4_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_4_000003_EnhancedMoveToHueAndSaturation -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced move to hue and saturation command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveToHueAndSaturationParams alloc] init]; - params.enhancedHue = [NSNumber numberWithUnsignedShort:1200U]; - params.saturation = [NSNumber numberWithUnsignedChar:90]; - params.transitionTime = [NSNumber numberWithUnsignedShort:10U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveToHueAndSaturationWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced move to hue and saturation command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_4_000004_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_7_4_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_8_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_CC_8_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000003_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:14]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:1]; - params.time = [NSNumber numberWithUnsignedShort:100U]; - params.startHue = [NSNumber numberWithUnsignedShort:500U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopDirection Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check ColorLoopDirection Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopTime Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check ColorLoopTime Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 100U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopStartEnhancedHue Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStartEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check ColorLoopStartEnhancedHue Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 500U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopActive Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check ColorLoopActive Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000008_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:1]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopActive Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check ColorLoopActive Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000010_ColorLoopSet -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Color Loop Set Command - Set direction and time while running"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:6]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:3500U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Set direction and time while running Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopDirection Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check ColorLoopDirection Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopTime Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check ColorLoopTime Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 3500U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000013_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set direction while running"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:2]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:1]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Set direction while running Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopDirection Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check ColorLoopDirection Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000015_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light that we turned on Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_8_1_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_9_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_CC_9_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition : Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition : Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000003_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000005_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:2]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000007_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:4]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:30U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 30U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000009_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:8]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:160U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStartEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 160U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000011_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:1]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull EnhancedCurrentHueValue1; -- (void)testSendClusterTest_TC_CC_9_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - EnhancedCurrentHueValue1 = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, EnhancedCurrentHueValue1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000015_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull ColorLoopStoredEnhancedHueValue1; -- (void)testSendClusterTest_TC_CC_9_1_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - ColorLoopStoredEnhancedHueValue1 = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, ColorLoopStoredEnhancedHueValue1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000019_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:2]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:1]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000021_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:1]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000022_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull EnhancedCurrentHueValue2; -- (void)testSendClusterTest_TC_CC_9_1_000023_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - EnhancedCurrentHueValue2 = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000024_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, EnhancedCurrentHueValue2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000025_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000026_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull ColorLoopStoredEnhancedHueValue2; -- (void)testSendClusterTest_TC_CC_9_1_000027_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - ColorLoopStoredEnhancedHueValue2 = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000028_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, ColorLoopStoredEnhancedHueValue2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000029_EnhancedMoveToHue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterEnhancedMoveToHueParams alloc] init]; - params.enhancedHue = [NSNumber numberWithUnsignedShort:40960U]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster enhancedMoveToHueWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Enhanced Move To Hue command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000030_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 2000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 2000); - [self waitForExpectationsWithTimeout:(2000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000031_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 40960U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000032_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:2]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000033_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000034_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:2]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000035_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull EnhancedCurrentHueValue3; -- (void)testSendClusterTest_TC_CC_9_1_000036_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - EnhancedCurrentHueValue3 = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000037_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, EnhancedCurrentHueValue3); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000038_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000039_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull ColorLoopStoredEnhancedHueValue3; -- (void)testSendClusterTest_TC_CC_9_1_000040_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - ColorLoopStoredEnhancedHueValue3 = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000041_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, ColorLoopStoredEnhancedHueValue3); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000042_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:2]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:1]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000043_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000044_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:2]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000045_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull EnhancedCurrentHueValue4; -- (void)testSendClusterTest_TC_CC_9_1_000046_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - EnhancedCurrentHueValue4 = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000047_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, EnhancedCurrentHueValue4); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000048_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000049_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull ColorLoopStoredEnhancedHue4; -- (void)testSendClusterTest_TC_CC_9_1_000050_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - ColorLoopStoredEnhancedHue4 = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000051_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, ColorLoopStoredEnhancedHue4); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000052_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn Off light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn Off light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_1_000053_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_9_2_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_CC_9_2_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000003_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:15]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:30U]; - params.startHue = [NSNumber numberWithUnsignedShort:160U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 30U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStartEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 160U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull EnhancedCurrentHueValue; -- (void)testSendClusterTest_TC_CC_9_2_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - EnhancedCurrentHueValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:1]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, EnhancedCurrentHueValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000012_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:2]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:1]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000014_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull ColorLoopStoredEnhancedHueValue; -- (void)testSendClusterTest_TC_CC_9_2_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - ColorLoopStoredEnhancedHueValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, ColorLoopStoredEnhancedHueValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000018_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_2_000019_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_CC_9_3_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_CC_9_3_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000003_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:15]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:30U]; - params.startHue = [NSNumber numberWithUnsignedShort:160U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopDirectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 30U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStartEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 160U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000008_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:1]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull EnhancedCurrentHueValue; -- (void)testSendClusterTest_TC_CC_9_3_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - EnhancedCurrentHueValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, EnhancedCurrentHueValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000012_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:4]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:60U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 60U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000014_ColorLoopSet -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPColorControlClusterColorLoopSetParams alloc] init]; - params.updateFlags = [NSNumber numberWithUnsignedChar:1]; - params.action = [NSNumber numberWithUnsignedChar:0]; - params.direction = [NSNumber numberWithUnsignedChar:0]; - params.time = [NSNumber numberWithUnsignedShort:0U]; - params.startHue = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster colorLoopSetWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopActiveWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull ColorLoopStoredEnhancedHueValue; -- (void)testSendClusterTest_TC_CC_9_3_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeColorLoopStoredEnhancedHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - ColorLoopStoredEnhancedHueValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, ColorLoopStoredEnhancedHueValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000018_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn off light for color control tests Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_CC_9_3_000019_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DD_1_5_000000_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 1"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, - @"Verify that the onboarding payload for NFC tags SHALL use NDEF URI Record Type Definition as defined by NFC Forum in URI " - @"Record Type Definition RTD URI"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DD_1_6_000000_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 1"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, @"Scan the DUTs QR code using a QR code reader"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DD_1_6_000001_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 1 verification"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, - @"Verify the QR code gets scanned successfully and the QR code must be of sufficient size and contrast respective to " - @"surface material as to be readable with standard readers such as smartphones in normal lighting conditions"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DD_1_6_000002_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 2 verificaiton"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, @"Verify QR code version is 1 or higher"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DD_1_7_000000_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, @"Verify manual pairing code is printed on the device or in additional provided materials"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DD_1_7_000001_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 1"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, - @"Verify that the Manual Pairing Code should be printed using a minimum font size of 6 points typically producing a " - @"typeface height of 2.1 mm"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DD_1_8_000000_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 1"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, @"Scan the device QR code using DUT"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DD_1_8_000001_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 1 verification"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, - @"Verify the DUT is able to scan and parse the QR code successfully to onboard the device onto the CHIP network"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DD_1_9_000000_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, @"Verify that the manual pairing code is printed on the device or in additional provided materials"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DD_1_9_000001_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 1"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, - @"Provide the 11 digit or 21 digit pairing code from the Device in text speech or any format supported by DUT"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DD_1_9_000002_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Step 1 verification"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, - @"Verify that the manual pairing code can be provided to DUT and parsed to onboard the device onto the CHIP network"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DM_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_DM_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Data Model Revision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDataModelRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query Data Model Revision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Vendor Name"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query Vendor Name Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 32); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query VendorID"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorIDWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query VendorID Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Product Name"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeProductNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query Product Name Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 32); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductID"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeProductIDWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query ProductID Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Node Label"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNodeLabelWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query Node Label Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 32); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Location"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLocationWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query User Location Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersion"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeHardwareVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query HardwareVersion Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersionString"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeHardwareVersionStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query HardwareVersionString Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertGreaterThanOrEqual([actualValue length], 1); - } - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 64); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersion"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSoftwareVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query SoftwareVersion Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersionString"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSoftwareVersionStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query SoftwareVersionString Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertGreaterThanOrEqual([actualValue length], 1); - } - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 64); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ManufacturingDate"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeManufacturingDateWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query ManufacturingDate Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertGreaterThanOrEqual([actualValue length], 8); - } - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 16); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query PartNumber"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePartNumberWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query PartNumber Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 32); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductURL"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeProductURLWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query ProductURL Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 256); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductLabel"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeProductLabelWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query ProductLabel Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 64); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SerialNumber"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSerialNumberWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query SerialNumber Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 32); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query LocalConfigDisabled"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLocalConfigDisabledWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query LocalConfigDisabled Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Reachable"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeReachableWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query Reachable Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_1_1_000019_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query UniqueID"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeUniqueIDWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query UniqueID Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 32); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DM_3_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_DM_3_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query MaxNetworks"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestNetworkCommissioning * cluster = [[CHIPTestNetworkCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxNetworksWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query MaxNetworks Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DM_3_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Networks"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestNetworkCommissioning * cluster = [[CHIPTestNetworkCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNetworksWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Query Networks Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DL_1_3_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_DL_1_3_000001_SetCredential -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Create new PIN credential and lock/unlock user"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDoorLock * cluster = [[CHIPTestDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0]; - params.credential = [[CHIPDoorLockClusterDlCredential alloc] init]; - ((CHIPDoorLockClusterDlCredential *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1]; - ((CHIPDoorLockClusterDlCredential *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = nil; - params.userStatus = nil; - params.userType = nil; - [cluster setCredentialWithParams:params - completionHandler:^(CHIPDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Create new PIN credential and lock/unlock user Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = values.userIndex; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - { - id actualValue = values.nextCredentialIndex; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 2U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DL_1_3_000002_LockDoor -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Door is in locked state"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDoorLock * cluster = [[CHIPTestDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPDoorLockClusterLockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster lockDoorWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: Door is in locked state Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DL_1_3_000003_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"TH writes AutoRelockTime attribute value as 10 seconds on the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDoorLock * cluster = [[CHIPTestDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"TH writes AutoRelockTime attribute value as 10 seconds on the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DL_1_3_000004_UnlockDoor -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"TH sends the unlock Door command to the DUT with valid PINCode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDoorLock * cluster = [[CHIPTestDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unlockDoorWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"TH sends the unlock Door command to the DUT with valid PINCode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DL_1_3_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads AutoRelockTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDoorLock * cluster = [[CHIPTestDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAutoRelockTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads AutoRelockTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 10UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DL_1_3_000006_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 10000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 10000); - [self waitForExpectationsWithTimeout:(10000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DL_1_3_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads LockState attriute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDoorLock * cluster = [[CHIPTestDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLockStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads LockState attriute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DL_1_3_000008_ClearCredential -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Clean the created credential"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDoorLock * cluster = [[CHIPTestDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[CHIPDoorLockClusterDlCredential alloc] init]; - ((CHIPDoorLockClusterDlCredential *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1]; - ((CHIPDoorLockClusterDlCredential *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster clearCredentialWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Clean the created credential Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_EMR_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_EMR_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 3U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_EMR_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_EMR_1_1_000003_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_EMR_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 3U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_EMR_1_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement 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_ETHDIAG_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_ETHDIAG_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read PHYRate attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePHYRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read PHYRate attribute constraints 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], 9); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ETHDIAG_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read FullDuplex attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFullDuplexWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read FullDuplex attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ETHDIAG_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read PacketRxCount attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePacketRxCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read PacketRxCount attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ETHDIAG_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read PacketTxCount attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePacketTxCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read PacketTxCount attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ETHDIAG_1_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read TxErrCount attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxErrCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read TxErrCount attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ETHDIAG_1_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CollisionCount attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCollisionCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CollisionCount attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ETHDIAG_1_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read OverrunCount attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOverrunCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read OverrunCount attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ETHDIAG_1_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CarrierDetect attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCarrierDetectWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CarrierDetect attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ETHDIAG_1_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read TimeSinceReset attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestEthernetNetworkDiagnostics * cluster = [[CHIPTestEthernetNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTimeSinceResetWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read TimeSinceReset attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_ETHDIAG_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_FLW_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_FLW_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000004_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default value to optional attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id measuredValueArgument; - measuredValueArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster - writeAttributeMeasuredValueWithValue:measuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default value to optional attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000005_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default value to optional attribute: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id minMeasuredValueArgument; - minMeasuredValueArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster - writeAttributeMinMeasuredValueWithValue:minMeasuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default value to optional attribute: MinMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000006_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default value to optional attribute: MaxMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id maxMeasuredValueArgument; - maxMeasuredValueArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster - writeAttributeMaxMeasuredValueWithValue:maxMeasuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default value to optional attribute: MaxMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Tolerance"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Tolerance Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Tolerance"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Tolerance Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - 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_FLW_2_1_000012_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to optional attribute: Tolerance"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id toleranceArgument; - toleranceArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeToleranceWithValue:toleranceArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default value to optional attribute: Tolerance Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Tolerance"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Tolerance Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_FLW_2_2_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_FLW_2_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_FLW_2_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [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_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_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_ILL_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads MinMeasuredValue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [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 unsignedShortValue], 1U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65533U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ILL_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads MaxMeasuredValue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MaxMeasuredValue attribute from DUT 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_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads Tolerance attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [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_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads LightSensorType attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLightSensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads LightSensorType attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_LVL_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_LVL_2_1_000001_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentLevel attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentLevel attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the RemainingTime attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRemainingTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the RemainingTime attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MinLevel attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MinLevel attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MaxLevel attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MaxLevel attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentFrequency attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentFrequency attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MinFrequency attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MinFrequency attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MaxFrequency attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MaxFrequency attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnOffTransitionTime attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnOffTransitionTime attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnLevel attribute "]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnLevel attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnTransitionTime attribute "]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnTransitionTime attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OffTransitionTime attribute "]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OffTransitionTime attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the DefaultMoveRate attribute "]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the DefaultMoveRate attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the Options attribute "]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOptionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the Options attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_LVL_2_2_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_LVL_2_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnOffTransitionTime attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnOffTransitionTime attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000002_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"writes the OnOffTransitionTime attribute on the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id onOffTransitionTimeArgument; - onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:10U]; - [cluster writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"writes the OnOffTransitionTime attribute on the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnOffTransitionTime attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnOffTransitionTime attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 10U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000004_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"writes default value of OnOffTransitionTime attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id onOffTransitionTimeArgument; - onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"writes default value of OnOffTransitionTime attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000005_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"writes the OnLevel attribute on the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id onLevelArgument; - onLevelArgument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeOnLevelWithValue:onLevelArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"writes the OnLevel attribute on the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnLevel attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnLevel attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000007_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes the OnTransitionTime attribute on the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id onTransitionTimeArgument; - onTransitionTimeArgument = [NSNumber numberWithUnsignedShort:100U]; - [cluster writeAttributeOnTransitionTimeWithValue:onTransitionTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the OnTransitionTime attribute on the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnTransitionTime attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnTransitionTime attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 100U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000009_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes the OffTransitionTime attribute on the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id offTransitionTimeArgument; - offTransitionTimeArgument = [NSNumber numberWithUnsignedShort:100U]; - [cluster writeAttributeOffTransitionTimeWithValue:offTransitionTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the OffTransitionTime attribute on the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OffTransitionTime attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OffTransitionTime attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 100U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the DefaultMoveRate attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the DefaultMoveRate attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 50); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000012_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes the DefaultMoveRate attribute on the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id defaultMoveRateArgument; - defaultMoveRateArgument = [NSNumber numberWithUnsignedChar:100]; - [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the DefaultMoveRate attribute on the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the DefaultMoveRate attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the DefaultMoveRate attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000014_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"writes the StartUpCurrentLevel attribute on the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id startUpCurrentLevelArgument; - startUpCurrentLevelArgument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeStartUpCurrentLevelWithValue:startUpCurrentLevelArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"writes the StartUpCurrentLevel attribute on the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_2_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads the StartUpCurrentLevel attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStartUpCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads the StartUpCurrentLevel attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_LVL_3_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_LVL_3_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MinLevel attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MinLevel attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MaxLevel attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MaxLevel attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000004_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000005_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 64); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000007_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000008_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 11000 second"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 11000); - [self waitForExpectationsWithTimeout:(11000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads On Off Transition Time attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000011_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 1000); - [self waitForExpectationsWithTimeout:(1000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 128); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000014_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000015_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_LVL_4_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]; -} -NSNumber * _Nonnull MaxlevelValue; -- (void)testSendClusterTest_TC_LVL_4_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads max level attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - MaxlevelValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000002_Move -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000003_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"user prompt message"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, - @"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"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000004_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); - [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, MaxlevelValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull MinlevelValue; -- (void)testSendClusterTest_TC_LVL_4_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads min level attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - MinlevelValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000007_Move -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000008_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"user prompt message"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, - @"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"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000009_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 5000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 5000); - [self waitForExpectationsWithTimeout:(5000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 1); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nullable DefaultMoveRateValue; -- (void)testSendClusterTest_TC_LVL_4_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads default move rate attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - DefaultMoveRateValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000012_Move -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command at default move rate"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000013_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 255); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000015_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"user prompt message"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, - @"Physically verify that the device moves at the rate recorded in step 3a and completes moving to its maximum level."); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000016_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000017_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_LVL_5_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_LVL_5_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000002_Step -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to its lowest point"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000003_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); - [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull CurrentlevelValue; -- (void)testSendClusterTest_TC_LVL_5_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - CurrentlevelValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000005_Step -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step up command to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000006_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 5000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 5000); - [self waitForExpectationsWithTimeout:(5000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, CurrentlevelValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000008_Step -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000009_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 4000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 4000); - [self waitForExpectationsWithTimeout:(4000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, CurrentlevelValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000011_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000012_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000013_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_LVL_6_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_LVL_6_1_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000002_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: set DUT to lowest point"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000003_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull CurrentLevelValue; -- (void)testSendClusterTest_TC_LVL_6_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentLevel attribute from 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], 1); - } - } - { - id actualValue = value; - CurrentLevelValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000005_Move -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000006_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 2000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 2000); - [self waitForExpectationsWithTimeout:(2000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000007_Stop -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, CurrentLevelValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000009_MoveToLevel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000010_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_6_1_000011_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_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_MC_2_1_000001_Sleep -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Put the device into low power mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster sleepWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Put the device into low power mode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_3_6_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_3_7_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_3_8_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_3_9_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_3_10_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_3_11_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_5_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_5_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the ChannelList attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestChannel * cluster = [[CHIPTestChannel alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeChannelListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the ChannelList attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_5_2_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_5_2_000001_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"verify that the channel has changed on the device."); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_5_3_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_5_3_000001_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"verify that the channel has changed on the device"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_6_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_6_1_000001_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that media is paused"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_1_000002_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Physically verify that the media is playing"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the playback state attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the playback state attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_1_000004_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Physically verify that the media is paused"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_1_000005_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Physically verify that the media is stoped"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_6_2_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_6_2_000001_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that media is paused"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_2_000002_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Physically verify that the media is playing"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentState attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentState attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_2_000004_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Physically verify that the media is started over"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_2_000005_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the next media item in the queue has been loaded"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_2_000006_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the previous media item in the queue has been loaded"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_2_000007_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the media has skipped forward 10 seconds"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_2_000008_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the media has skipped backward 10 seconds"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_6_3_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_6_3_000001_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that media is paused"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_3_000002_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the media has moved to 10 seconds from the starting point."); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_3_000003_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"User prompt needed to enter the value beyond the furthest valid position"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_6_4_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_6_4_000001_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that media is paused"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_4_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the PlaybackSpeed attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePlaybackSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the PlaybackSpeed attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue floatValue], 0.0f); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_4_000003_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the media is playing"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_4_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentState attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentState attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_4_000005_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the media play speed has increased"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_4_000006_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the media play has reversed direction"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_4_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentState attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentState attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_4_000008_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the media play has reversed direction"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_6_4_000009_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Verify that the media is has resumed playing forward at the default speed"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_7_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_7_2_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_8_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_8_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentTarget attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentTargetWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentTarget attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_8_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the TargetList attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTargetListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the TargetList attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_MC_9_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_9_1_000001_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, @"DUT has one or more Content Apps available"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_9_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the VendorName attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the VendorName attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 32); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_9_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the VendorID attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorIDWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the VendorID attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_9_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the ApplicationName attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeApplicationNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the ApplicationName attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 256); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_9_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the ProductID attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeProductIDWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the ProductID attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_9_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the Status attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the Status attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_MC_9_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the ApplicationVersion attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeApplicationVersionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the ApplicationVersion attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 32); - } - - [expectation fulfill]; - }]; - - [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_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_OCC_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads mandatory attribute constrains: Occupancy"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attribute constrains: Occupancy 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], 1); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_1_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: Occupancy"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: Occupancy"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: Occupancy Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorType"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupancySensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attribute constrains: OccupancySensorType 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], 3); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_1_000005_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorType"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorType"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupancySensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: OccupancySensorType Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupancySensorTypeBitmapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 1); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 7); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_1_000008_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorTypeBitmap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupancySensorTypeBitmapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: OccupancySensorTypeBitmap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_OCC_2_2_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]; -} -NSNumber * _Nonnull OccupancyValue; -- (void)testSendClusterTest_TC_OCC_2_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = value; - OccupancyValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OCC_2_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back Occupancy attribute from DUT after few seconds"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back Occupancy attribute from DUT after few seconds Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_OO_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_OO_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: GlobalSceneControl"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LT attribute: GlobalSceneControl Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OnTime"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LT attribute: OnTime Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OffWaitTime"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LT attribute: OffWaitTime Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: StartUpOnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStartUpOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LT attribute: StartUpOnOff Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_OO_2_2_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_OO_2_2_000001_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000003_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000005_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000007_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000009_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000011_Toggle -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster toggleWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Toggle Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000012_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 1000); - [self waitForExpectationsWithTimeout:(1000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Check on/off attribute value is true after toggle command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after toggle command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000014_Toggle -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster toggleWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Toggle Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000015_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 1000); - [self waitForExpectationsWithTimeout:(1000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000016_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Check on/off attribute value is false after toggle command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after toggle command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000017_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User prompt Set OnOff attribute manually to on"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operate on device to set OnOff attribute manually to on"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000018_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User prompt Set OnOff attribute manually to off"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operate on device to set OnOff attribute manually to off"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000019_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset Off Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Reset Off Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_2_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_OO_2_3_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_OO_2_3_000001_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 1000); - [self waitForExpectationsWithTimeout:(1000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000005_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000006_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 1000); - [self waitForExpectationsWithTimeout:(1000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000009_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000010_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 1000); - [self waitForExpectationsWithTimeout:(1000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000015_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000019_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000021_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000022_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000023_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000024_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000025_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000026_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000027_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000028_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000029_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000030_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000031_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000032_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000033_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000034_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000035_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000036_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000037_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000038_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000039_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000040_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000041_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000042_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000043_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000044_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000045_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_OO_2_3_000046_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_PS_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_PS_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Test Harness Client reads Status attribute from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads Status attribute from Server 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], 3); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PS_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Test Harness Client reads Order attribute from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOrderWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads Order attribute from Server DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PS_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Test Harness Client reads Description attribute from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads Description attribute from Server DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PS_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Test Harness Client reads BatVoltage from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBatteryVoltageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads BatVoltage from Server DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PS_2_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Test Harness Client reads BatPercentRemaining from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBatteryPercentRemainingWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads BatPercentRemaining from Server 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], 200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PS_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Test Harness Client reads BatTimeRemaining from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBatteryTimeRemainingWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads BatTimeRemaining from Server DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PS_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Test Harness Client reads BatChargeLevel from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBatteryChargeLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads BatChargeLevel from Server 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_PS_2_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Test Harness Client reads ActiveBatFaults from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeActiveBatteryFaultsWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads ActiveBatFaults from Server DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PS_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Test Harness Client reads BatChargeState from Server DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBatteryChargeStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Test Harness Client reads BatChargeState from Server 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], 3); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_PRS_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_PRS_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute constraints: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute constraints: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PRS_2_1_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id measuredValueArgument; - measuredValueArgument = [NSNumber numberWithShort:0]; - [cluster - writeAttributeMeasuredValueWithValue:measuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PRS_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PRS_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read the mandatory attribute constraints: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute constraints: MinMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PRS_2_1_000005_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id minMeasuredValueArgument; - minMeasuredValueArgument = [NSNumber numberWithShort:0]; - [cluster - writeAttributeMinMeasuredValueWithValue:minMeasuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: MinMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PRS_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: MinMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PRS_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read the mandatory attribute constraints: MaxMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute constraints: MaxMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PRS_2_1_000008_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default values to mandatory attribute: MaxMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id maxMeasuredValueArgument; - maxMeasuredValueArgument = [NSNumber numberWithShort:0]; - [cluster - writeAttributeMaxMeasuredValueWithValue:maxMeasuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: MaxMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PRS_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: MaxMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: MaxMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_PCC_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_PCC_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_1_1_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl 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_PCC_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl 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_PCC_1_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl 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_PCC_1_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_1_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_1_1_000008_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to optional global attribute: FeatureMap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_1_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back optional global attribute: FeatureMap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_PCC_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_PCC_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxPressure Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxSpeed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxSpeed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxFlow"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxFlow Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: EffectiveOperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveOperationMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: EffectiveControlMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveControlMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: Capacity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCapacityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: Capacity Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxPressure Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxSpeed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxSpeed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxFlow"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxFlow Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: EffectiveOperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveOperationMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: EffectiveControlMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveControlMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: Capacity"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCapacityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: Capacity Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinConstPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstPressure Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxConstPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstPressure Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinCompPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinCompPressure Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxCompPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxCompPressure Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinConstSpeed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstSpeed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxConstSpeed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstSpeed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000019_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinConstFlow"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstFlow Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxConstFlow"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstFlow Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000021_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinConstTemp"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstTemp Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000022_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxConstTemp"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstTemp Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000023_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: PumpStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: PumpStatus Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000024_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: PumpStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: PumpStatus Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000025_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Speed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Speed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000026_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: LifetimeRunningHours"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000027_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: LifetimeRunningHours"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000028_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Power"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePowerWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Power Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000029_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: LifetimeEnergyConsumed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000030_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: LifetimeEnergyConsumed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000031_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"write to the optional attribute: LifetimeEnergyConsumed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write to the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000032_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinConstPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstPressure Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000033_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxConstPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstPressure Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000034_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinCompPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinCompPressure Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000035_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxCompPressure"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxCompPressure Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000036_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinConstSpeed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstSpeed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000037_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxConstSpeed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstSpeed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000038_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinConstFlow"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstFlow Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000039_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxConstFlow"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstFlow Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000040_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MinConstTemp"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstTemp Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 32767); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000041_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: MaxConstTemp"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstTemp Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 32767); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000042_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: PumpStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: PumpStatus Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000043_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: PumpStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: PumpStatus Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000044_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Speed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Speed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000045_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: LifetimeRunningHours"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000046_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: LifetimeRunningHours"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000047_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Power"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePowerWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Power Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000048_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: LifetimeEnergyConsumed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000049_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: LifetimeEnergyConsumed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_PCC_2_2_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_PCC_2_2_000001_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write 1 to the OperationMode attribute to DUT: OperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveOperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveOperationMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_2_000003_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write 2 to the OperationMode attribute to DUT: OperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_2_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveOperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveOperationMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_2_000005_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write 3 to the OperationMode attribute to DUT: OperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveOperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveOperationMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 3); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_PCC_2_3_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_PCC_2_3_000001_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 0 to the OperationMode attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id operationModeArgument; - operationModeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeOperationModeWithValue:operationModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 0 to the OperationMode attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveOperationMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveOperationMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000003_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 0 to the ControlMode attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 0 to the ControlMode attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveControlMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveControlMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000005_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 1 to the ControlMode attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 1 to the ControlMode attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveControlMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveControlMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000007_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 2 to the ControlMode attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:2]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 2 to the ControlMode attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveControlMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveControlMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000009_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 3 to the ControlMode attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:3]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 3 to the ControlMode attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveControlMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveControlMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 3); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000011_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 5 to the ControlMode attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:5]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 5 to the ControlMode attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveControlMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveControlMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 5); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000013_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 7 to the ControlMode attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:7]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 7 to the ControlMode attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_3_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: EffectiveControlMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveControlMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 7); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_PCC_2_4_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_PCC_2_4_000001_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 1 to the LifetimeRunningHours attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id lifetimeRunningHoursArgument; - lifetimeRunningHoursArgument = [NSNumber numberWithUnsignedInt:1UL]; - [cluster writeAttributeLifetimeRunningHoursWithValue:lifetimeRunningHoursArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 1 to the LifetimeRunningHours attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: LifetimeRunningHours"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: LifetimeRunningHours Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 1UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000003_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 2 to the LifetimeRunningHours attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id lifetimeRunningHoursArgument; - lifetimeRunningHoursArgument = [NSNumber numberWithUnsignedInt:2UL]; - [cluster writeAttributeLifetimeRunningHoursWithValue:lifetimeRunningHoursArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 2 to the LifetimeRunningHours attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: LifetimeRunningHours"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: LifetimeRunningHours Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 2UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000005_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 3 to the LifetimeRunningHours attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id lifetimeRunningHoursArgument; - lifetimeRunningHoursArgument = [NSNumber numberWithUnsignedInt:3UL]; - [cluster writeAttributeLifetimeRunningHoursWithValue:lifetimeRunningHoursArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 3 to the LifetimeRunningHours attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: LifetimeRunningHours"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: LifetimeRunningHours Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 3UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000007_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 1 to the LifetimeEnergyConsumed attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:1UL]; - [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 1 to the LifetimeEnergyConsumed attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: LifetimeEnergyConsumed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: LifetimeEnergyConsumed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 1UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000009_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 2 to the LifetimeEnergyConsumed attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:2UL]; - [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 2 to the LifetimeEnergyConsumed attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: LifetimeEnergyConsumed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: LifetimeEnergyConsumed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 2UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000011_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write 3 to the LifetimeEnergyConsumed attribute to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:3UL]; - [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 3 to the LifetimeEnergyConsumed attribute to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_4_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the attribute: LifetimeEnergyConsumed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: LifetimeEnergyConsumed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 3UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_PSCFG_1_1_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Commission DUT to TH"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PSCFG_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(); - CHIPTestPowerSourceConfiguration * cluster = [[CHIPTestPowerSourceConfiguration alloc] initWithDevice:device - endpoint:0 - 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_PSCFG_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(); - CHIPTestPowerSourceConfiguration * cluster = [[CHIPTestPowerSourceConfiguration alloc] initWithDevice:device - endpoint:0 - 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_PSCFG_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the AcceptedCommandList attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSourceConfiguration * cluster = [[CHIPTestPowerSourceConfiguration alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the AcceptedCommandList attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PSCFG_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the GeneratedCommandList attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSourceConfiguration * cluster = [[CHIPTestPowerSourceConfiguration alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the GeneratedCommandList attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_RH_2_2_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_RH_2_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of attribute: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of attribute: MinMeasuredValue 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], 9999U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_RH_2_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads MeasuredValue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads MeasuredValue 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], 10000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_RH_2_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_SWTCH_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_SWTCH_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read NumberOfPositions attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNumberOfPositionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read NumberOfPositions attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read NumberOfPositions attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNumberOfPositionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read NumberOfPositions attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 2); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentPosition attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentPosition attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentPosition attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentPosition attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read MultiPressMax attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMultiPressMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read MultiPressMax attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read MultiPressMax attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMultiPressMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read MultiPressMax attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 2); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_SWTCH_2_2_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_SWTCH_2_2_000001_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Set up subscription to SwitchLatched event"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000002_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator sets switch to first position"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentPosition attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentPosition attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000004_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator sets switch to second position"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000005_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Set up subscription to InitialPress event"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000006_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator does not operate switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentPosition attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentPosition attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000008_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator sets switch to second position"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000009_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator does not operate switch (release switch)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000010_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Set up subscription to InitialPress and ShortRelease events"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000011_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator does not operate switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000012_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch (press briefly)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000013_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000014_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch for 5 seconds"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000015_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); - [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000016_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000017_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000018_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator does not operate switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000019_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch (press briefly)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000020_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000021_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch for 5 seconds"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000022_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); - [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000023_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000024_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt( - expectation, queue, @"Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000025_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator does not operate switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000026_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch (press briefly)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000027_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000028_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch (press briefly)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000029_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000030_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch again (press briefly)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000031_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000032_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch again (press briefly)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000033_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000034_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch again (press briefly)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000035_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000036_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator operates switch again (press briefly)"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWTCH_2_2_000037_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"Operator releases switch"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_TM_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_TM_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TM_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 32766); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TM_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -27314); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 32767); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TM_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Tolerance"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Tolerance Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - 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_TM_2_2_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_TM_2_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 32766); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TM_2_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -27314); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 32767); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TM_2_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads MeasuredValue attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TM_2_2_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: MeasuredValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: MeasuredValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_TSTAT_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_TSTAT_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat 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_TSTAT_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read the optional global attribute constraints: FeatureMap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional global attribute constraints: FeatureMap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_TSTAT_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_TSTAT_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: LocalTemperature"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLocalTemperatureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: LocalTemperature Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 2600); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 2600); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: MinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: MinCoolSetpointLimit Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation 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_TSTAT_2_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: SystemMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: SystemMode 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], 9); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue charValue], 0); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue charValue], 25); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000015_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: StartOfWeek"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStartOfWeekWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: StartOfWeek Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 6); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000016_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNumberOfWeeklyTransitionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000017_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: NumberOfDailyTransitions"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNumberOfDailyTransitionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: NumberOfDailyTransitions Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_TSTAT_2_2_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_TSTAT_2_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is within range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2600); - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 2600); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value back that is different but valid for OccupiedCoolingSetpoint attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000004_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of MinCoolSetpointLimit to OccupiedCoolingSetpoint attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000005_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of MaxCoolSetpointLimit to OccupiedCoolingSetpoint attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Reads OccupiedHeatingSetpoint attribute from Server DUT and verifies that the value is within range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2000); - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000007_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value back that is different but valid for OccupiedHeatingSetpoint attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Reads it back again to confirm the successful write of OccupiedHeatingSetpoint attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of OccupiedHeatingSetpoint attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000009_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of MinHeatSetpointLimit to OccupiedHeatingSetpoint attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of MinHeatSetpointLimit to OccupiedHeatingSetpoint " - @"attribute Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000010_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of MaxHeatSetpointLimit to OccupiedHeatingSetpoint attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of MaxHeatSetpointLimit to OccupiedHeatingSetpoint " - @"attribute Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000011_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the value is within range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 700); - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000012_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value back that is different but valid for MinHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000013_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads it back again to confirm the successful write of MinHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of MinHeatSetpointLimit attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000014_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of AbsMinHeatSetpointLimit to MinHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMinHeatSetpointLimit to MinHeatSetpointLimit attribute " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000015_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of AbsMaxHeatSetpointLimit to MinHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMaxHeatSetpointLimit to MinHeatSetpointLimit attribute " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000016_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Reads MaxHeatSetpointLimit attribute from Server DUT and verifies that the value is within range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3000); - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000017_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value back that is different but valid for MaxHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000018_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads it back again to confirm the successful write of MaxHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of MaxHeatSetpointLimit attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000019_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of AbsMinHeatSetpointLimit to MaxHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMinHeatSetpointLimit to MaxHeatSetpointLimit attribute " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000020_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of AbsMaxHeatSetpointLimit to MaxHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMaxHeatSetpointLimit to MaxHeatSetpointLimit attribute " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000021_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 1600); - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000022_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value back that is different but valid for MinCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000023_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000024_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of AbsMinCoolSetpointLimit to MinCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000025_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000026_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3200); - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000027_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value back that is different but valid for MaxCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000028_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [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.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000029_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of AbsMinCoolSetpointLimit to MaxCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000030_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000031_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes (sets back) the limit of MinHeatSetpointLimit to MinHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000032_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes (sets back) the limit of MaxHeatSetpointLimit to MinHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000033_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes (sets back) the limit of MinHeatSetpointLimit to MaxHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000034_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes (sets back) the limit of MaxHeatSetpointLimit to MaxHeatSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000035_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes (sets back) the limit of MinCoolSetpointLimit to MinCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000036_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes (sets back) the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000037_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes (sets back) the limit of MinCoolSetpointLimit to MaxCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000038_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes (sets back) the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000039_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads ControlSequenceOfOperation from Server DUT and verifies that the value is valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads ControlSequenceOfOperation from Server DUT and verifies that the value is valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 4); - } - { - 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_TSTAT_2_2_000040_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write Attribute command for ControlSequenceOfOperation with a new valid value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000041_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read it back again to confirm the successful write"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read it back again to confirm the successful write Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000042_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sets OccupiedHeatingSetpoint to default value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000043_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sets OccupiedHeatingSetpoint to default value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000044_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sets OccupiedCoolingSetpoint to default value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000045_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sets OccupiedCoolingSetpoint to default value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000046_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sets OccupiedCoolingSetpoint to default value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000047_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sets OccupiedHeatingSetpoint to default value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000048_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sets OccupiedCoolingSetpoint to default value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_2_000049_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sets OccupiedHeatingSetpoint to default value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_TSUIC_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_TSUIC_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode 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], 1); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout 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_TSUIC_2_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility 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], 1); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_TSUIC_2_2_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_TSUIC_2_2_000001_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value of 0 to TemperatureDisplayMode attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value of 1 to TemperatureDisplayMode attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000003_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000004_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 0 to KeypadLockout attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000005_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 1 to KeypadLockout attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000006_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 2 to KeypadLockout attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000007_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 3 to KeypadLockout attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000008_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 4 to KeypadLockout attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000009_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 5 to KeypadLockout attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000010_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value of greater than 5 to KeypadLockout attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000011_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000012_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_2_000013_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - 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); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DIAG_TH_NW_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_DIAG_TH_NW_1_1_000001_ResetCounts -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ResetCounts command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster resetCountsWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ResetCounts command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the Overruncount attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOverrunCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the Overruncount attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_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_DIAG_TH_NW_1_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: Channel"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeChannelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: Channel Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: NetworkName"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNetworkNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: NetworkName Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 16); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: PanId"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePanIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: PanId Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ExtendedPanId"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeExtendedPanIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ExtendedPanId Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: OverrunCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOverrunCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: OverrunCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read PartitionId attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePartitionIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read PartitionId attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: PartitionId"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePartitionIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: PartitionId Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read Weighting attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeWeightingWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read Weighting attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: weighting"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeWeightingWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: weighting Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read DataVersion attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDataVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read DataVersion attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: DataVersion"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDataVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: DataVersion Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read StableDataVersion attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStableDataVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read StableDataVersion attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: StableDataVersion"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStableDataVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: StableDataVersion Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read LeaderRouterId attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLeaderRouterIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LeaderRouterId attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: LeaderRouterId"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLeaderRouterIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: LeaderRouterId Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read DetachedRoleCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDetachedRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read DetachedRoleCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: DetachedRoleCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDetachedRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: DetachedRoleCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read ChildRoleCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeChildRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read ChildRoleCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000019_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ChildRoleCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeChildRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ChildRoleCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RouterRoleCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRouterRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RouterRoleCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000021_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RouterRoleCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRouterRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RouterRoleCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000022_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read LeaderRoleCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLeaderRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LeaderRoleCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000023_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: LeaderRoleCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLeaderRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: LeaderRoleCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000024_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read AttachAttemptCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAttachAttemptCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read AttachAttemptCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000025_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: AttachAttemptCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAttachAttemptCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: AttachAttemptCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000026_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read PartitionIdChangeCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePartitionIdChangeCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read PartitionIdChangeCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000027_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: PartitionIdChangeCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePartitionIdChangeCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: PartitionIdChangeCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000028_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read BetterPartitionAttachAttemptCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeBetterPartitionAttachAttemptCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read BetterPartitionAttachAttemptCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000029_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: BetterPartitionAttachAttemptCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeBetterPartitionAttachAttemptCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: BetterPartitionAttachAttemptCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000030_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read ParentChangeCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeParentChangeCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read ParentChangeCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000031_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ParentChangeCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeParentChangeCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ParentChangeCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000032_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxTotalCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxTotalCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxTotalCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000033_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxTotalCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxTotalCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxTotalCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000034_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxUnicastCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxUnicastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxUnicastCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000035_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxUnicastCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxUnicastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxUnicastCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000036_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxBroadcastCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxBroadcastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxBroadcastCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000037_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxBroadcastCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxBroadcastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxBroadcastCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000038_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxNoAckRequestedCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxNoAckRequestedCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxNoAckRequestedCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000039_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxNoAckRequestedCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxNoAckRequestedCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxNoAckRequestedCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000040_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxDataCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxDataCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxDataCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000041_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxDataCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxDataCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxDataCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000042_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxDataPollCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxDataPollCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxDataPollCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000043_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxDataPollCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxDataPollCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxDataPollCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000044_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxBeaconCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxBeaconCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxBeaconCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000045_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxBeaconCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxBeaconCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxBeaconCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000046_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxBeaconRequestCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxBeaconRequestCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxBeaconRequestCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000047_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxBeaconRequestCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxBeaconRequestCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxBeaconRequestCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000048_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxOtherCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxOtherCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000049_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxOtherCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxOtherCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000050_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxRetryCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxRetryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxRetryCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000051_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxRetryCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxRetryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxRetryCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000052_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxDirectMaxRetryExpiryCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxDirectMaxRetryExpiryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxDirectMaxRetryExpiryCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000053_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: TxDirectMaxRetryExpiryCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxDirectMaxRetryExpiryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxDirectMaxRetryExpiryCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000054_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxIndirectMaxRetryExpiryCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeTxIndirectMaxRetryExpiryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxIndirectMaxRetryExpiryCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000055_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: TxIndirectMaxRetryExpiryCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeTxIndirectMaxRetryExpiryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxIndirectMaxRetryExpiryCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000056_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxErrCcaCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxErrCcaCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxErrCcaCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000057_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxErrCcaCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxErrCcaCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxErrCcaCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000058_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxErrAbortCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxErrAbortCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxErrAbortCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000059_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxErrAbortCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxErrAbortCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxErrAbortCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000060_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read TxErrBusyChannelCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxErrBusyChannelCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read TxErrBusyChannelCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000061_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: TxErrBusyChannelCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTxErrBusyChannelCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: TxErrBusyChannelCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000062_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxTotalCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxTotalCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxTotalCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000063_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxTotalCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxTotalCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxTotalCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000064_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxUnicastCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxUnicastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxUnicastCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000065_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxUnicastCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxUnicastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxUnicastCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000066_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxBroadcastCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxBroadcastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxBroadcastCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000067_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxBroadcastCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxBroadcastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxBroadcastCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000068_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxDataCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxDataCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxDataCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000069_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxDataCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxDataCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxDataCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000070_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxDataPollCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxDataPollCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxDataPollCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000071_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxDataPollCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxDataPollCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxDataPollCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000072_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxBeaconCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxBeaconCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxBeaconCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000073_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxBeaconCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxBeaconCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxBeaconCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000074_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxBeaconRequestCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxBeaconRequestCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxBeaconRequestCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000075_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxBeaconRequestCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxBeaconRequestCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxBeaconRequestCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000076_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxOtherCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxOtherCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000077_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxOtherCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxOtherCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000078_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxAddressFilteredCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxAddressFilteredCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxAddressFilteredCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000079_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: RxAddressFilteredCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxAddressFilteredCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxAddressFilteredCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000080_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxDestAddrFilteredCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxDestAddrFilteredCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxDestAddrFilteredCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000081_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: RxDestAddrFilteredCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxDestAddrFilteredCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxDestAddrFilteredCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000082_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxDuplicatedCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxDuplicatedCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxDuplicatedCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000083_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxDuplicatedCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxDuplicatedCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxDuplicatedCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000084_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxErrNoFrameCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrNoFrameCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxErrNoFrameCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000085_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxErrNoFrameCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrNoFrameCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxErrNoFrameCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000086_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxErrUnknownNeighborCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrUnknownNeighborCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxErrUnknownNeighborCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000087_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: RxErrUnknownNeighborCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrUnknownNeighborCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxErrUnknownNeighborCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000088_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxErrInvalidScrAddrCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrInvalidSrcAddrCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxErrInvalidScrAddrCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000089_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: RxErrInvalidSrcAddrCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrInvalidSrcAddrCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxErrInvalidSrcAddrCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000090_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxErrSecCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrSecCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxErrSecCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000091_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Validate constraints of attribute: RxErrInvalidSrcAddrCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrSecCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxErrInvalidSrcAddrCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000092_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxErrFcsCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrFcsCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxErrFcsCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000093_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxErrFcsCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrFcsCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxErrFcsCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000094_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read RxErrOtherCount attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read RxErrOtherCount attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000095_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: RxErrOtherCount"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRxErrOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: RxErrOtherCount Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000096_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read ActiveTimestamp attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeActiveTimestampWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read ActiveTimestamp attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000097_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: ActiveTimestamp"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeActiveTimestampWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: ActiveTimestamp Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000098_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read PendingTimestamp attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePendingTimestampWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read PendingTimestamp attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000099_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: PendingTimestamp"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePendingTimestampWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: PendingTimestamp Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000100_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read Delay attribute value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDelayWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read Delay attribute value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_DIAG_TH_NW_1_2_000101_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate constraints of attribute: delay"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDelayWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate constraints of attribute: delay Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_LC_1_2_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_LC_1_2_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH1 reads LabelList attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestUserLabel * cluster = [[CHIPTestUserLabel alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLabelListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads LabelList attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WIFIDIAG_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_WIFIDIAG_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads NetworkInterface structure attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGeneralDiagnostics * cluster = [[CHIPTestGeneralDiagnostics alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNetworkInterfacesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads NetworkInterface structure attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads SecurityType attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSecurityTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads SecurityType attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads SecurityType attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSecurityTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads SecurityType attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads WiFiVersion attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeWiFiVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads WiFiVersion attribute constraints 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_WIFIDIAG_1_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads ChannelNumber attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeChannelNumberWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads ChannelNumber attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads RSSI attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRssiWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads RSSI attribute constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue charValue], -120); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue charValue], 0); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WIFIDIAG_3_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_WNCV_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_WNCV_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2: read the global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 5U); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 200U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_1_1_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:201U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3b: reads back global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 201U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering 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_WNCV_1_1_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2: read the global attribute: FeatureMap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the global attribute: FeatureMap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedIntValue], 0UL); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedIntValue], 32768UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_1_1_000006_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write the default value to optional global attribute: FeatureMap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id featureMapArgument; - featureMapArgument = [NSNumber numberWithUnsignedInt:32769UL]; - [cluster writeAttributeFeatureMapWithValue:featureMapArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write the default value to optional global attribute: FeatureMap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_1_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3b: reads back global attribute: FeatureMap"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back global attribute: FeatureMap Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedIntValue], 32769UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_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_WNCV_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2: read the RO mandatory attribute default: Type"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO mandatory attribute default: Type 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], 9); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000002_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3a: write a value into the RO mandatory attribute: Type"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id typeArgument; - typeArgument = [NSNumber numberWithUnsignedChar:250]; - [cluster writeAttributeTypeWithValue:typeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO mandatory attribute: Type Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3b: reads back the RO mandatory attribute: Type"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO mandatory attribute: Type Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 250); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2: read the RO mandatory attribute default: ConfigStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO mandatory attribute default: ConfigStatus 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], 63); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000005_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO mandatory attribute: ConfigStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id configStatusArgument; - configStatusArgument = [NSNumber numberWithUnsignedChar:128]; - [cluster writeAttributeConfigStatusWithValue:configStatusArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO mandatory attribute: ConfigStatus Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3b: reads back the RO mandatory attribute: ConfigStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO mandatory attribute: ConfigStatus Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 128); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO mandatory attribute default: OperationalStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOperationalStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO mandatory attribute default: OperationalStatus 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], 63); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000008_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO mandatory attribute: OperationalStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id operationalStatusArgument; - operationalStatusArgument = [NSNumber numberWithUnsignedChar:128]; - [cluster - writeAttributeOperationalStatusWithValue:operationalStatusArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO mandatory attribute: OperationalStatus Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO mandatory attribute: OperationalStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOperationalStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO mandatory attribute: OperationalStatus Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 128); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO mandatory attribute default: EndProductType"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEndProductTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO mandatory attribute default: EndProductType 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], 23); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000011_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO mandatory attribute: EndProductType"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id endProductTypeArgument; - endProductTypeArgument = [NSNumber numberWithUnsignedChar:250]; - [cluster - writeAttributeEndProductTypeWithValue:endProductTypeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO mandatory attribute: EndProductType Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO mandatory attribute: EndProductType"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEndProductTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO mandatory attribute: EndProductType Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 250); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2: read the RW mandatory attribute default: Mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RW mandatory attribute default: Mode 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], 15); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000014_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3a: write a value into the RW mandatory attribute:: Mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id modeArgument; - modeArgument = [NSNumber numberWithUnsignedChar:8]; - [cluster writeAttributeModeWithValue:modeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RW mandatory attribute:: Mode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3b: reads back the RW mandatory attribute: Mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RW mandatory attribute: Mode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 8); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000016_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO optional attribute default: TargetPositionLiftPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeTargetPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO optional attribute default: TargetPositionLiftPercent100ths 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], 10000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000017_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO optional attribute: TargetPositionLiftPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id targetPositionLiftPercent100thsArgument; - targetPositionLiftPercent100thsArgument = [NSNumber numberWithUnsignedShort:20000U]; - [cluster writeAttributeTargetPositionLiftPercent100thsWithValue:targetPositionLiftPercent100thsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO optional attribute: " - @"TargetPositionLiftPercent100ths Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000018_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO optional attribute: TargetPositionLiftPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeTargetPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO optional attribute: TargetPositionLiftPercent100ths Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 20000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000019_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO optional attribute default: TargetPositionTiltPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeTargetPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO optional attribute default: TargetPositionTiltPercent100ths 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], 10000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000020_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO optional attribute: TargetPositionTiltPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id targetPositionTiltPercent100thsArgument; - targetPositionTiltPercent100thsArgument = [NSNumber numberWithUnsignedShort:20000U]; - [cluster writeAttributeTargetPositionTiltPercent100thsWithValue:targetPositionTiltPercent100thsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO optional attribute: " - @"TargetPositionTiltPercent100ths Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000021_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO optional attribute: TargetPositionTiltPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeTargetPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO optional attribute: TargetPositionTiltPercent100ths Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 20000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000022_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO optional attribute default: CurrentPositionLiftPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO optional attribute default: CurrentPositionLiftPercent100ths 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], 10000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000023_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO optional attribute: CurrentPositionLiftPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentPositionLiftPercent100thsArgument; - currentPositionLiftPercent100thsArgument = [NSNumber numberWithUnsignedShort:20000U]; - [cluster writeAttributeCurrentPositionLiftPercent100thsWithValue:currentPositionLiftPercent100thsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO optional attribute: " - @"CurrentPositionLiftPercent100ths Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000024_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO optional attribute: CurrentPositionLiftPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO optional attribute: CurrentPositionLiftPercent100ths Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 20000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000025_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO optional attribute default: CurrentPositionTiltPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO optional attribute default: CurrentPositionTiltPercent100ths 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], 10000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000026_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO optional attribute: CurrentPositionTiltPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentPositionTiltPercent100thsArgument; - currentPositionTiltPercent100thsArgument = [NSNumber numberWithUnsignedShort:20000U]; - [cluster writeAttributeCurrentPositionTiltPercent100thsWithValue:currentPositionTiltPercent100thsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO optional attribute: " - @"CurrentPositionTiltPercent100ths Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000027_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO optional attribute: CurrentPositionTiltPercent100ths"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO optional attribute: CurrentPositionTiltPercent100ths Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 20000U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000028_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO optional attribute default: InstalledOpenLimitLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInstalledOpenLimitLiftWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO optional attribute default: InstalledOpenLimitLift 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000029_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO optional attribute: InstalledOpenLimitLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id installedOpenLimitLiftArgument; - installedOpenLimitLiftArgument = [NSNumber numberWithUnsignedShort:255U]; - [cluster - writeAttributeInstalledOpenLimitLiftWithValue:installedOpenLimitLiftArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO optional attribute: InstalledOpenLimitLift Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000030_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO optional attribute: InstalledOpenLimitLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInstalledOpenLimitLiftWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO optional attribute: InstalledOpenLimitLift 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000031_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO optional attribute default: InstalledClosedLimitLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInstalledClosedLimitLiftWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO optional attribute default: InstalledClosedLimitLift 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000032_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO optional attribute: InstalledClosedLimitLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id installedClosedLimitLiftArgument; - installedClosedLimitLiftArgument = [NSNumber numberWithUnsignedShort:255U]; - [cluster writeAttributeInstalledClosedLimitLiftWithValue:installedClosedLimitLiftArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO optional attribute: InstalledClosedLimitLift " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000033_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO optional attribute: InstalledClosedLimitLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInstalledClosedLimitLiftWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO optional attribute: InstalledClosedLimitLift 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000034_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO optional attribute default: InstalledOpenLimitTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInstalledOpenLimitTiltWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO optional attribute default: InstalledOpenLimitTilt 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000035_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO optional attribute: InstalledOpenLimitTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id installedOpenLimitTiltArgument; - installedOpenLimitTiltArgument = [NSNumber numberWithUnsignedShort:255U]; - [cluster - writeAttributeInstalledOpenLimitTiltWithValue:installedOpenLimitTiltArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO optional attribute: InstalledOpenLimitTilt Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000036_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO optional attribute: InstalledOpenLimitTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInstalledOpenLimitTiltWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO optional attribute: InstalledOpenLimitTilt 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000037_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2: read the RO optional attribute default: InstalledClosedLimitTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInstalledClosedLimitTiltWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2: read the RO optional attribute default: InstalledClosedLimitTilt 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000038_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: write a value into the RO optional attribute: InstalledClosedLimitTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id installedClosedLimitTiltArgument; - installedClosedLimitTiltArgument = [NSNumber numberWithUnsignedShort:255U]; - [cluster writeAttributeInstalledClosedLimitTiltWithValue:installedClosedLimitTiltArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: write a value into the RO optional attribute: InstalledClosedLimitTilt " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000039_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: reads back the RO optional attribute: InstalledClosedLimitTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInstalledClosedLimitTiltWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: reads back the RO optional attribute: InstalledClosedLimitTilt 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000040_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"4: read the RO mandatory attribute default: SafetyStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSafetyStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"4: read the RO mandatory attribute default: SafetyStatus 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], 2047U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000041_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5a: write a value into the RO mandatory attribute: SafetyStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id safetyStatusArgument; - safetyStatusArgument = [NSNumber numberWithUnsignedShort:4096U]; - [cluster writeAttributeSafetyStatusWithValue:safetyStatusArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"5a: write a value into the RO mandatory attribute: SafetyStatus Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000042_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"5b: reads back the RO mandatory attribute: SafetyStatus"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSafetyStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"5b: reads back the RO mandatory attribute: SafetyStatus Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 4096U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000043_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"4: read the RO optional attribute default: CurrentPositionLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentPositionLiftWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"4: read the RO optional attribute default: CurrentPositionLift 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000044_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5a: write a value into the RO optional attribute: CurrentPositionLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentPositionLiftArgument; - currentPositionLiftArgument = [NSNumber numberWithUnsignedShort:255U]; - [cluster - writeAttributeCurrentPositionLiftWithValue:currentPositionLiftArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"5a: write a value into the RO optional attribute: CurrentPositionLift Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000045_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5b: reads back the RO optional attribute: CurrentPositionLift"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentPositionLiftWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"5b: reads back the RO optional attribute: CurrentPositionLift 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000046_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"4: read the RO optional attribute default: CurrentPositionTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentPositionTiltWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"4: read the RO optional attribute default: CurrentPositionTilt 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000047_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5a: write a value into the RO optional attribute: CurrentPositionTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentPositionTiltArgument; - currentPositionTiltArgument = [NSNumber numberWithUnsignedShort:255U]; - [cluster - writeAttributeCurrentPositionTiltWithValue:currentPositionTiltArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"5a: write a value into the RO optional attribute: CurrentPositionTilt Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000048_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5b: reads back the RO optional attribute: CurrentPositionTilt"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentPositionTiltWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"5b: reads back the RO optional attribute: CurrentPositionTilt 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], 65535U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000049_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"4: read the RO optional attribute default: CurrentPositionLiftPercentage"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"4: read the RO optional attribute default: CurrentPositionLiftPercentage 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], 100); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000050_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5a: write a value into the RO optional attribute: CurrentPositionLiftPercentage"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentPositionLiftPercentageArgument; - currentPositionLiftPercentageArgument = [NSNumber numberWithUnsignedChar:200]; - [cluster writeAttributeCurrentPositionLiftPercentageWithValue:currentPositionLiftPercentageArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"5a: write a value into the RO optional attribute: " - @"CurrentPositionLiftPercentage Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000051_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5b: reads back the RO optional attribute: CurrentPositionLiftPercentage"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"5b: reads back the RO optional attribute: CurrentPositionLiftPercentage Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000052_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"4: read the RO optional attribute default: CurrentPositionTiltPercentage"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"4: read the RO optional attribute default: CurrentPositionTiltPercentage 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], 100); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000053_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5a: write a value into the RO optional attribute: CurrentPositionTiltPercentage"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id currentPositionTiltPercentageArgument; - currentPositionTiltPercentageArgument = [NSNumber numberWithUnsignedChar:200]; - [cluster writeAttributeCurrentPositionTiltPercentageWithValue:currentPositionTiltPercentageArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"5a: write a value into the RO optional attribute: " - @"CurrentPositionTiltPercentage Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_1_000054_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"5b: reads back the RO optional attribute: CurrentPositionTiltPercentage"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"5b: reads back the RO optional attribute: CurrentPositionTiltPercentage Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_2_2_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_WNCV_2_3_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_WNCV_2_3_000001_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"1a: TH set the Mode Attribute bit0 of the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id modeArgument; - modeArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeModeWithValue:modeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"1a: TH set the Mode Attribute bit0 of the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"1b: TH reads ConfigStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"1b: TH reads ConfigStatus attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 4); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000003_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"1c: TH clear the Mode Attribute bit0 of the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id modeArgument; - modeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeModeWithValue:modeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"1c: TH clear the Mode Attribute bit0 of the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"1d: TH reads ConfigStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"1d: TH reads ConfigStatus attribute from 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], 127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000005_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2a: TH set the Mode Attribute bit1 of the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id modeArgument; - modeArgument = [NSNumber numberWithUnsignedChar:2]; - [cluster writeAttributeModeWithValue:modeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"2a: TH set the Mode Attribute bit1 of the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull configStatusValA; -- (void)testSendClusterTest_TC_WNCV_2_3_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2b: TH reads ConfigStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2b: TH reads ConfigStatus attribute from 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], 127); - } - } - { - id actualValue = value; - configStatusValA = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000007_DownOrClose -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_FAILURE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000008_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2d: TH clear the Mode Attribute bit1 of the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id modeArgument; - modeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeModeWithValue:modeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"2d: TH clear the Mode Attribute bit1 of the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2e: TH reads ConfigStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2e: TH reads ConfigStatus attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 1); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2f: TH reads the Mode Attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2f: TH reads the Mode 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], 127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000011_DownOrClose -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2g: TH send DownOrClose command to the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"2g: TH send DownOrClose command to the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000012_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3a: TH set the Mode Attribute bit2 of the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id modeArgument; - modeArgument = [NSNumber numberWithUnsignedChar:4]; - [cluster writeAttributeModeWithValue:modeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: TH set the Mode Attribute bit2 of the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull configStatusValB; -- (void)testSendClusterTest_TC_WNCV_2_3_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3c: TH reads ConfigStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3c: TH reads ConfigStatus attribute from 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], 127); - } - } - { - id actualValue = value; - configStatusValB = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000014_DownOrClose -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3c: TH send DownOrClose command to the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"3c: TH send DownOrClose command to the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_BUSY); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000015_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3d: TH clear the Mode Attribute bit2 of the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id modeArgument; - modeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeModeWithValue:modeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3d: TH clear the Mode Attribute bit2 of the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3e: TH reads ConfigStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3e: TH reads ConfigStatus attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 1); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3f: TH reads the Mode Attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3f: TH reads the Mode 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], 127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_3_000018_DownOrClose -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3g: TH send DownOrClose command to the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"3g: TH send DownOrClose command to the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_2_4_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_WNCV_2_4_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Type attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads Type attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_4_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Type attribute constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads Type attribute constraints 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], 9); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_2_5_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_WNCV_2_5_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads EndProductType attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEndProductTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads EndProductType attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_2_5_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads EndProductType attribute constraints from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEndProductTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads EndProductType attribute constraints from 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], 23); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_3_4_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"0: 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_WNCV_3_4_000001_DownOrClose -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"1a: TH sends DownOrClose command to preposition the DUT in the opposite direction Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_4_000002_WaitForMs -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1b: TH Waits for fastMotionDuration seconds movement(s) on the device"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); - [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_4_000003_UpOrOpen -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2a: TH sends UpOrOpen command to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster upOrOpenWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"2a: TH sends UpOrOpen command to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_4_000004_WaitForMs -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2b: TH Waits for fullMotionDuration seconds movement(s) on the device"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 6000); - [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_4_000005_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_4_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_4_000007_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_4_000008_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_3_5_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"0: 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_WNCV_3_5_000001_UpOrOpen -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster upOrOpenWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_5_000002_WaitForMs -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1b: TH Waits for fastMotionDuration seconds movement(s) on the device"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); - [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_5_000003_DownOrClose -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2a: TH sends DownOrClose command to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"2a: TH sends DownOrClose command to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_5_000004_WaitForMs -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2b: TH Waits for fullMotionDuration seconds movement(s) on the device"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 6000); - [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_5_000005_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 10000U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_5_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_5_000007_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 10000U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_3_5_000008_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_4_1_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"0: 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_WNCV_4_1_000001_DownOrClose -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"1a: TH sends DownOrClose command to preposition the DUT in the opposite direction Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"1b: TH waits for x seconds movement(s) on the DUT"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 6000); - [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 0U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000004_GoToLiftPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2a: TH sends GoToLiftPercentage command with 25 percent to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToLiftPercentageParams alloc] init]; - params.liftPercentageValue = [NSNumber numberWithUnsignedChar:25]; - params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:2500U]; - [cluster goToLiftPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"2a: TH sends GoToLiftPercentage command with 25 percent to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000005_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2b: DUT updates its attributes"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeTargetPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 2500U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000007_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3a: TH set a timeout of X minutes for failure"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 6000); - [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3b: TH reads OperationalStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOperationalStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: TH reads OperationalStatus attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000009_GoToLiftPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"4a: TH sends GoToLiftPercentage command with 75.20 percent to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToLiftPercentageParams alloc] init]; - params.liftPercentageValue = [NSNumber numberWithUnsignedChar:75]; - params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:7520U]; - [cluster goToLiftPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"4a: TH sends GoToLiftPercentage command with 75.20 percent to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000010_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"4b: DUT updates its attributes"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000011_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"5a: TH waits for x seconds movement(s) on the DUT"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 6000); - [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_1_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"5b: TH reads OperationalStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOperationalStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"5b: TH reads OperationalStatus attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_4_2_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"0: 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_WNCV_4_2_000001_DownOrClose -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"1a: TH sends DownOrClose command to preposition the DUT in the opposite direction Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"1b: TH waits for x seconds movement(s) on the DUT"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 6000); - [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000003_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"1c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 0U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000004_GoToTiltPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2a: TH sends GoToTiltPercentage command with 30 percent to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToTiltPercentageParams alloc] init]; - params.tiltPercentageValue = [NSNumber numberWithUnsignedChar:30]; - params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:3000U]; - [cluster goToTiltPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"2a: TH sends GoToTiltPercentage command with 30 percent to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000005_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"2b: DUT updates its attributes"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeTargetPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"2c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 3000U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000007_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3a: TH set a timeout of X minutes for failure"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 6000); - [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"3b: TH reads OperationalStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOperationalStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"3b: TH reads OperationalStatus attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000009_GoToTiltPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"4a: TH sends GoToTiltPercentage command with 60.20 percent to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToTiltPercentageParams alloc] init]; - params.tiltPercentageValue = [NSNumber numberWithUnsignedChar:60]; - params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:6005U]; - [cluster goToTiltPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"4a: TH sends GoToTiltPercentage command with 60.20 percent to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000010_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"4b: DUT updates its attributes"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000011_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"5a: TH waits for x seconds movement(s) on the DUT"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 6000); - [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_2_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"5b: TH reads OperationalStatus attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOperationalStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"5b: TH reads OperationalStatus attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_4_3_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"0: 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]; -} -NSNumber * _Nullable attrCurrentPositionLiftPercent100ths; -- (void)testSendClusterTest_TC_WNCV_4_3_000001_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths 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], 10000U); - } - } - { - id actualValue = value; - attrCurrentPositionLiftPercent100ths = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nullable attrCurrentPositionLiftPercentage; -- (void)testSendClusterTest_TC_WNCV_4_3_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1b: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionLiftPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"1b: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from 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], 100); - } - } - { - id actualValue = value; - attrCurrentPositionLiftPercentage = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_3_000003_GoToLiftPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2b: TH sends GoToLiftPercentage command with BadParam to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToLiftPercentageParams alloc] init]; - params.liftPercentageValue = [NSNumber numberWithUnsignedChar:63]; - params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:12288U]; - [cluster goToLiftPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"2b: TH sends GoToLiftPercentage command with BadParam to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_3_000004_GoToLiftPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: TH sends GoToLiftPercentage command with 10001 to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToLiftPercentageParams alloc] init]; - params.liftPercentageValue = [NSNumber numberWithUnsignedChar:100]; - params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:10001U]; - [cluster goToLiftPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: TH sends GoToLiftPercentage command with 10001 to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_3_000005_GoToLiftPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToLiftPercentageParams alloc] init]; - params.liftPercentageValue = [NSNumber numberWithUnsignedChar:255]; - params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:65535U]; - [cluster goToLiftPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_WNCV_4_4_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"0: 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]; -} -NSNumber * _Nullable attrCurrentPositionTiltPercent100ths; -- (void)testSendClusterTest_TC_WNCV_4_4_000001_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths 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], 10000U); - } - } - { - id actualValue = value; - attrCurrentPositionTiltPercent100ths = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nullable attrCurrentPositionTiltPercentage; -- (void)testSendClusterTest_TC_WNCV_4_4_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"1b: If (PA_TL & TL) TH reads CurrentPositionTiltPercentage from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeCurrentPositionTiltPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"1b: If (PA_TL & TL) TH reads CurrentPositionTiltPercentage from 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], 100); - } - } - { - id actualValue = value; - attrCurrentPositionTiltPercentage = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_4_000003_GoToTiltPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"2b: TH sends GoToTiltPercentage command with BadParam to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToTiltPercentageParams alloc] init]; - params.tiltPercentageValue = [NSNumber numberWithUnsignedChar:63]; - params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:12288U]; - [cluster goToTiltPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"2b: TH sends GoToTiltPercentage command with BadParam to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_4_000004_GoToTiltPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"3a: TH sends GoToTiltPercentage command with 10001 to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToTiltPercentageParams alloc] init]; - params.tiltPercentageValue = [NSNumber numberWithUnsignedChar:100]; - params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:10001U]; - [cluster goToTiltPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"3a: TH sends GoToTiltPercentage command with 10001 to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_WNCV_4_4_000005_GoToTiltPercentage -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPWindowCoveringClusterGoToTiltPercentageParams alloc] init]; - params.tiltPercentageValue = [NSNumber numberWithUnsignedChar:255]; - params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:65535U]; - [cluster goToTiltPercentageWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestCluster_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)testSendClusterTestCluster_000001_Test -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster testWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Test Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000002_TestNotHandled -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Not Handled Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster testNotHandledWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Test Not Handled Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_INVALID_COMMAND); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000003_TestSpecific -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Specific Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster testSpecificWithCompletionHandler:^( - CHIPTestClusterClusterTestSpecificResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Specific Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.returnValue; - XCTAssertEqual([actualValue unsignedCharValue], 7); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000004_TestAddArguments -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Add Arguments Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestAddArgumentsParams alloc] init]; - params.arg1 = [NSNumber numberWithUnsignedChar:3]; - params.arg2 = [NSNumber numberWithUnsignedChar:17]; - [cluster testAddArgumentsWithParams:params - completionHandler:^( - CHIPTestClusterClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Add Arguments Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.returnValue; - XCTAssertEqual([actualValue unsignedCharValue], 20); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000005_TestAddArguments -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send failing Test Add Arguments Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestAddArgumentsParams alloc] init]; - params.arg1 = [NSNumber numberWithUnsignedChar:250]; - params.arg2 = [NSNumber numberWithUnsignedChar:6]; - [cluster testAddArgumentsWithParams:params - completionHandler:^( - CHIPTestClusterClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send failing Test Add Arguments Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_INVALID_COMMAND); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BOOLEAN Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000007_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BOOLEAN True"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id booleanArgument; - booleanArgument = [NSNumber numberWithBool:1]; - [cluster writeAttributeBooleanWithValue:booleanArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BOOLEAN True Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN True"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BOOLEAN True Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000009_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BOOLEAN False"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id booleanArgument; - booleanArgument = [NSNumber numberWithBool:0]; - [cluster writeAttributeBooleanWithValue:booleanArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BOOLEAN False Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN False"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BOOLEAN False Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP8 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000012_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP8 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap8Argument; - bitmap8Argument = [NSNumber numberWithUnsignedChar:255]; - [cluster writeAttributeBitmap8WithValue:bitmap8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP8 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP8 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 255); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000014_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP8 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap8Argument; - bitmap8Argument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeBitmap8WithValue:bitmap8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP8 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000015_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP8 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP16 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000017_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP16 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap16Argument; - bitmap16Argument = [NSNumber numberWithUnsignedShort:65535U]; - [cluster writeAttributeBitmap16WithValue:bitmap16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP16 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP16 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 65535U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000019_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP16 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap16Argument; - bitmap16Argument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeBitmap16WithValue:bitmap16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP16 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP16 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000021_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP32 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000022_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP32 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap32Argument; - bitmap32Argument = [NSNumber numberWithUnsignedInt:4294967295UL]; - [cluster writeAttributeBitmap32WithValue:bitmap32Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP32 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000023_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP32 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 4294967295UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000024_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP32 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap32Argument; - bitmap32Argument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeBitmap32WithValue:bitmap32Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP32 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000025_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP32 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000026_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP64 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000027_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP64 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap64Argument; - bitmap64Argument = [NSNumber numberWithUnsignedLongLong:18446744073709551615ULL]; - [cluster writeAttributeBitmap64WithValue:bitmap64Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP64 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000028_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP64 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 18446744073709551615ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000029_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP64 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap64Argument; - bitmap64Argument = [NSNumber numberWithUnsignedLongLong:0ULL]; - [cluster writeAttributeBitmap64WithValue:bitmap64Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP64 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000030_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP64 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000031_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000032_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8uArgument; - int8uArgument = [NSNumber numberWithUnsignedChar:255]; - [cluster writeAttributeInt8uWithValue:int8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000033_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 255); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000034_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8uArgument; - int8uArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeInt8uWithValue:int8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000035_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000036_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000037_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16uArgument; - int16uArgument = [NSNumber numberWithUnsignedShort:65535U]; - [cluster writeAttributeInt16uWithValue:int16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000038_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 65535U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000039_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16uArgument; - int16uArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeInt16uWithValue:int16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000040_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000041_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000042_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32uArgument; - int32uArgument = [NSNumber numberWithUnsignedInt:4294967295UL]; - [cluster writeAttributeInt32uWithValue:int32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000043_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 4294967295UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000044_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32uArgument; - int32uArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeInt32uWithValue:int32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000045_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000046_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000047_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64uArgument; - int64uArgument = [NSNumber numberWithUnsignedLongLong:18446744073709551615ULL]; - [cluster writeAttributeInt64uWithValue:int64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT64U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000048_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 18446744073709551615ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000049_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64uArgument; - int64uArgument = [NSNumber numberWithUnsignedLongLong:0ULL]; - [cluster writeAttributeInt64uWithValue:int64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT64U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000050_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000051_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000052_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8sArgument; - int8sArgument = [NSNumber numberWithChar:127]; - [cluster writeAttributeInt8sWithValue:int8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000053_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], 127); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000054_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8sArgument; - int8sArgument = [NSNumber numberWithChar:-128]; - [cluster writeAttributeInt8sWithValue:int8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000055_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], -128); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000056_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8sArgument; - int8sArgument = [NSNumber numberWithChar:0]; - [cluster writeAttributeInt8sWithValue:int8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000057_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000058_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000059_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16sArgument; - int16sArgument = [NSNumber numberWithShort:32767]; - [cluster writeAttributeInt16sWithValue:int16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000060_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 32767); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000061_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16sArgument; - int16sArgument = [NSNumber numberWithShort:-32768]; - [cluster writeAttributeInt16sWithValue:int16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000062_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], -32768); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000063_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16sArgument; - int16sArgument = [NSNumber numberWithShort:0]; - [cluster writeAttributeInt16sWithValue:int16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000064_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000065_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue intValue], 0L); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000066_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32sArgument; - int32sArgument = [NSNumber numberWithInt:2147483647L]; - [cluster writeAttributeInt32sWithValue:int32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000067_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue intValue], 2147483647L); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000068_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32sArgument; - int32sArgument = [NSNumber numberWithInt:-2147483648L]; - [cluster writeAttributeInt32sWithValue:int32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000069_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue intValue], -2147483648L); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000070_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32sArgument; - int32sArgument = [NSNumber numberWithInt:0L]; - [cluster writeAttributeInt32sWithValue:int32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000071_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue intValue], 0L); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000072_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue longLongValue], 0LL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000073_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64sArgument; - int64sArgument = [NSNumber numberWithLongLong:9223372036854775807LL]; - [cluster writeAttributeInt64sWithValue:int64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT64S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000074_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue longLongValue], 9223372036854775807LL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000075_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64sArgument; - int64sArgument = [NSNumber numberWithLongLong:-9223372036854775807LL]; - [cluster writeAttributeInt64sWithValue:int64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT64S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000076_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue longLongValue], -9223372036854775807LL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000077_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64sArgument; - int64sArgument = [NSNumber numberWithLongLong:0LL]; - [cluster writeAttributeInt64sWithValue:int64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT64S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000078_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue longLongValue], 0LL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000079_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute SINGLE Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute SINGLE Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue floatValue], 0.0f); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000080_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute SINGLE medium Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id floatSingleArgument; - floatSingleArgument = [NSNumber numberWithFloat:0.1f]; - [cluster writeAttributeFloatSingleWithValue:floatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute SINGLE medium Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000081_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute SINGLE medium Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute SINGLE medium Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue floatValue], 0.1f); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000082_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute SINGLE large Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id floatSingleArgument; - floatSingleArgument = [NSNumber numberWithFloat:17000000000.0f]; - [cluster writeAttributeFloatSingleWithValue:floatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute SINGLE large Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000083_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute SINGLE large Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute SINGLE large Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue floatValue], 17000000000.0f); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000084_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute SINGLE small Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id floatSingleArgument; - floatSingleArgument = [NSNumber numberWithFloat:1.7e-10f]; - [cluster writeAttributeFloatSingleWithValue:floatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute SINGLE small Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000085_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute SINGLE small Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute SINGLE small Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue floatValue], 1.7e-10f); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000086_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute SINGLE Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id floatSingleArgument; - floatSingleArgument = [NSNumber numberWithFloat:0.0f]; - [cluster writeAttributeFloatSingleWithValue:floatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute SINGLE Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000087_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute SINGLE Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute SINGLE Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue floatValue], 0.0f); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000088_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute DOUBLE Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute DOUBLE Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue doubleValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000089_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute DOUBLE medium Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id floatDoubleArgument; - floatDoubleArgument = [NSNumber numberWithDouble:0.1234567890123]; - [cluster writeAttributeFloatDoubleWithValue:floatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute DOUBLE medium Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000090_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute DOUBLE medium Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute DOUBLE medium Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue doubleValue], 0.1234567890123); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000091_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute DOUBLE large Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id floatDoubleArgument; - floatDoubleArgument = [NSNumber numberWithDouble:1.7e+200]; - [cluster writeAttributeFloatDoubleWithValue:floatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute DOUBLE large Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000092_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute DOUBLE large Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute DOUBLE large Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue doubleValue], 1.7e+200); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000093_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute DOUBLE small Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id floatDoubleArgument; - floatDoubleArgument = [NSNumber numberWithDouble:1.7e-200]; - [cluster writeAttributeFloatDoubleWithValue:floatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute DOUBLE small Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000094_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute DOUBLE small Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute DOUBLE small Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue doubleValue], 1.7e-200); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000095_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute DOUBLE Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id floatDoubleArgument; - floatDoubleArgument = [NSNumber numberWithDouble:0]; - [cluster writeAttributeFloatDoubleWithValue:floatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute DOUBLE Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000096_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute DOUBLE Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute DOUBLE Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue doubleValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000097_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM8 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000098_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM8 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enum8Argument; - enum8Argument = [NSNumber numberWithUnsignedChar:255]; - [cluster writeAttributeEnum8WithValue:enum8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute ENUM8 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000099_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM8 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 255); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000100_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM8 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enum8Argument; - enum8Argument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeEnum8WithValue:enum8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute ENUM8 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000101_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM8 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000102_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM16 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000103_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM16 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enum16Argument; - enum16Argument = [NSNumber numberWithUnsignedShort:65535U]; - [cluster writeAttributeEnum16WithValue:enum16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute ENUM16 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000104_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM16 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 65535U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000105_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM16 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enum16Argument; - enum16Argument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeEnum16WithValue:enum16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute ENUM16 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000106_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM16 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000107_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute OCTET_STRING Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute OCTET_STRING Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"" length:0]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000108_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute OCTET_STRING with embedded null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"Tes\000ti\000ng" length:9]; - [cluster writeAttributeOctetStringWithValue:octetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute OCTET_STRING with embedded null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000109_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute OCTET_STRING with embedded null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute OCTET_STRING with embedded null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"Tes\000ti\000ng" length:9]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000110_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute OCTET_STRING with weird chars"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"\015\012\377\042\240" length:5]; - [cluster writeAttributeOctetStringWithValue:octetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute OCTET_STRING with weird chars Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000111_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute OCTET_STRING with weird chars"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute OCTET_STRING with weird chars Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"\015\012\377\042\240" length:5]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000112_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"TestValue" length:9]; - [cluster writeAttributeOctetStringWithValue:octetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000113_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"TestValue" length:9]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000114_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"TestValueLongerThan10" length:21]; - [cluster writeAttributeOctetStringWithValue:octetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000115_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"TestValue" length:9]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000116_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"" length:0]; - [cluster writeAttributeOctetStringWithValue:octetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000117_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_OCTET_STRING Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLongOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LONG_OCTET_STRING Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"" length:0]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000118_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id longOctetStringArgument; - longOctetStringArgument = [[NSData alloc] - initWithBytes:"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - length:300]; - [cluster writeAttributeLongOctetStringWithValue:longOctetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute LONG_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000119_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLongOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LONG_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue - isEqualToData:[[NSData alloc] - initWithBytes:"1111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "1111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "1111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "111111111111111111111111111111111111111111111111111111" - length:300]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000120_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id longOctetStringArgument; - longOctetStringArgument = [[NSData alloc] initWithBytes:"" length:0]; - [cluster writeAttributeLongOctetStringWithValue:longOctetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute LONG_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000121_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@""]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000122_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"☉T☉"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000123_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@"☉T☉"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000124_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING - Value too long"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"☉TestValueLongerThan10☉"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING - Value too long Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000125_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@"☉T☉"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000126_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING - Empty"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @""; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING - Empty Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000127_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_CHAR_STRING Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLongCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LONG_CHAR_STRING Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@""]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000128_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id longCharStringArgument; - longCharStringArgument - = @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉"; - [cluster writeAttributeLongCharStringWithValue:longCharStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute LONG_CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000129_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLongCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LONG_CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue - isEqualToString: - @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000130_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id longCharStringArgument; - longCharStringArgument = @""; - [cluster writeAttributeLongCharStringWithValue:longCharStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute LONG_CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000131_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST_LONG_OCTET_STRING (for chunked read)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListLongOctetStringWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LIST_LONG_OCTET_STRING (for chunked read) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 4); - XCTAssertTrue([actualValue[0] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - XCTAssertTrue([actualValue[1] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - XCTAssertTrue([actualValue[2] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - XCTAssertTrue([actualValue[3] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000132_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write attribute LIST_LONG_OCTET_STRING (for chunked write)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id listLongOctetStringArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]; - temp_0[1] = [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]; - temp_0[2] = [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]; - temp_0[3] = [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]; - temp_0[4] = [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]; - listLongOctetStringArgument = temp_0; - } - [cluster writeAttributeListLongOctetStringWithValue:listLongOctetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute LIST_LONG_OCTET_STRING (for chunked write) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000133_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST_LONG_OCTET_STRING (for chunked read)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListLongOctetStringWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LIST_LONG_OCTET_STRING (for chunked read) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 5); - XCTAssertTrue([actualValue[0] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - XCTAssertTrue([actualValue[1] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - XCTAssertTrue([actualValue[2] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - XCTAssertTrue([actualValue[3] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - XCTAssertTrue([actualValue[4] - isEqualToData: - [[NSData alloc] - initWithBytes:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef" - length:512]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000134_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_US Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochUsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_US Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000135_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute EPOCH_US Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id epochUsArgument; - epochUsArgument = [NSNumber numberWithUnsignedLongLong:18446744073709551615ULL]; - [cluster writeAttributeEpochUsWithValue:epochUsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute EPOCH_US Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000136_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_US Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochUsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_US Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 18446744073709551615ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000137_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute EPOCH_US Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id epochUsArgument; - epochUsArgument = [NSNumber numberWithUnsignedLongLong:0ULL]; - [cluster writeAttributeEpochUsWithValue:epochUsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute EPOCH_US Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000138_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_US Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochUsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_US Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000139_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochSWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000140_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute EPOCH_S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id epochSArgument; - epochSArgument = [NSNumber numberWithUnsignedInt:4294967295UL]; - [cluster writeAttributeEpochSWithValue:epochSArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute EPOCH_S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000141_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_S Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochSWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_S Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 4294967295UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000142_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute EPOCH_S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id epochSArgument; - epochSArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeEpochSWithValue:epochSArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute EPOCH_S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000143_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochSWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000144_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute UNSUPPORTED"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeUnsupportedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute UNSUPPORTED Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000145_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Writeattribute UNSUPPORTED"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id unsupportedArgument; - unsupportedArgument = [NSNumber numberWithBool:0]; - [cluster writeAttributeUnsupportedWithValue:unsupportedArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writeattribute UNSUPPORTED Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000146_Test -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Command to unsupported endpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:200 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster testWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Test Command to unsupported endpoint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000147_Test -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Command to unsupported cluster"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster testWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Test Command to unsupported cluster Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000148_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute vendor_id Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute vendor_id Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000149_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute vendor_id"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id vendorIdArgument; - vendorIdArgument = [NSNumber numberWithUnsignedShort:17U]; - [cluster writeAttributeVendorIdWithValue:vendorIdArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute vendor_id Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000150_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute vendor_id"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute vendor_id Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 17U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000151_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Restore attribute vendor_id"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id vendorIdArgument; - vendorIdArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeVendorIdWithValue:vendorIdArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Restore attribute vendor_id Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000152_TestEnumsRequest -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send a command with a vendor_id and enum"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestEnumsRequestParams alloc] init]; - params.arg1 = [NSNumber numberWithUnsignedShort:20003U]; - params.arg2 = [NSNumber numberWithUnsignedChar:101]; - [cluster - testEnumsRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterTestEnumsResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send a command with a vendor_id and enum Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.arg1; - XCTAssertEqual([actualValue unsignedShortValue], 20003U); - } - { - id actualValue = values.arg2; - XCTAssertEqual([actualValue unsignedCharValue], 101); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000153_TestStructArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With Struct Argument and arg1.b is true"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestStructArgumentRequestParams alloc] init]; - params.arg1 = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).c = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).d = [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).h = [NSNumber numberWithDouble:0]; - - [cluster testStructArgumentRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterBooleanResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Command With Struct Argument and arg1.b is true Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], true); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000154_TestStructArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With Struct Argument and arg1.b is false"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestStructArgumentRequestParams alloc] init]; - params.arg1 = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).b = [NSNumber numberWithBool:false]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).c = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).d = [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).h = [NSNumber numberWithDouble:0]; - - [cluster testStructArgumentRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterBooleanResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Command With Struct Argument and arg1.b is false Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], false); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000155_TestNestedStructArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With Nested Struct Argument and arg1.c.b is true"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestNestedStructArgumentRequestParams alloc] init]; - params.arg1 = [[CHIPTestClusterClusterNestedStruct alloc] init]; - ((CHIPTestClusterClusterNestedStruct *) params.arg1).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterNestedStruct *) params.arg1).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterNestedStruct *) params.arg1).c = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).a = - [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).b = - [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).c = - [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).d = - [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).f = - [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).g = - [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).h = - [NSNumber numberWithDouble:0]; - - [cluster - testNestedStructArgumentRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterBooleanResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Command With Nested Struct Argument and arg1.c.b is true Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], true); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000156_TestNestedStructArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With Nested Struct Argument arg1.c.b is false"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestNestedStructArgumentRequestParams alloc] init]; - params.arg1 = [[CHIPTestClusterClusterNestedStruct alloc] init]; - ((CHIPTestClusterClusterNestedStruct *) params.arg1).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterNestedStruct *) params.arg1).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterNestedStruct *) params.arg1).c = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).a = - [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).b = - [NSNumber numberWithBool:false]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).c = - [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).d = - [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).f = - [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).g = - [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStruct *) params.arg1).c).h = - [NSNumber numberWithDouble:0]; - - [cluster testNestedStructArgumentRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterBooleanResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Command With Nested Struct Argument arg1.c.b is false Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], false); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000157_TestNestedStructListArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With Nested Struct List Argument and all fields b of arg1.d are true"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestNestedStructListArgumentRequestParams alloc] init]; - params.arg1 = [[CHIPTestClusterClusterNestedStructList alloc] init]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).c = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).a = - [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).b = - [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).c = - [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).d = - [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).f = - [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).g = - [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).h = - [NSNumber numberWithDouble:0]; - - { - NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; - temp_1[0] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).a = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).d = [[NSData alloc] initWithBytes:"nested_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).e = @"nested_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).h = [NSNumber numberWithDouble:0]; - - temp_1[1] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).a = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).d = [[NSData alloc] initWithBytes:"nested_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).e = @"nested_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).h = [NSNumber numberWithDouble:0]; - - ((CHIPTestClusterClusterNestedStructList *) params.arg1).d = temp_1; - } - { - NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; - temp_1[0] = [NSNumber numberWithUnsignedInt:1UL]; - temp_1[1] = [NSNumber numberWithUnsignedInt:2UL]; - temp_1[2] = [NSNumber numberWithUnsignedInt:3UL]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).e = temp_1; - } - { - NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; - temp_1[0] = [[NSData alloc] initWithBytes:"octet_string_1" length:14]; - temp_1[1] = [[NSData alloc] initWithBytes:"octect_string_2" length:15]; - temp_1[2] = [[NSData alloc] initWithBytes:"octet_string_3" length:14]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).f = temp_1; - } - { - NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; - temp_1[0] = [NSNumber numberWithUnsignedChar:0]; - temp_1[1] = [NSNumber numberWithUnsignedChar:255]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).g = temp_1; - } - - [cluster testNestedStructListArgumentRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Send Test Command With Nested Struct List Argument and all fields b of arg1.d " - @"are true Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], true); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000158_TestNestedStructListArgumentRequest -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Send Test Command With Nested Struct List Argument and some fields b of arg1.d are false"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestNestedStructListArgumentRequestParams alloc] init]; - params.arg1 = [[CHIPTestClusterClusterNestedStructList alloc] init]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).c = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).a = - [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).b = - [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).c = - [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).d = - [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).f = - [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).g = - [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) params.arg1).c).h = - [NSNumber numberWithDouble:0]; - - { - NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; - temp_1[0] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).a = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).d = [[NSData alloc] initWithBytes:"nested_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).e = @"nested_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[0]).h = [NSNumber numberWithDouble:0]; - - temp_1[1] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).a = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).b = [NSNumber numberWithBool:false]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).d = [[NSData alloc] initWithBytes:"nested_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).e = @"nested_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_1[1]).h = [NSNumber numberWithDouble:0]; - - ((CHIPTestClusterClusterNestedStructList *) params.arg1).d = temp_1; - } - { - NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; - temp_1[0] = [NSNumber numberWithUnsignedInt:1UL]; - temp_1[1] = [NSNumber numberWithUnsignedInt:2UL]; - temp_1[2] = [NSNumber numberWithUnsignedInt:3UL]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).e = temp_1; - } - { - NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; - temp_1[0] = [[NSData alloc] initWithBytes:"octet_string_1" length:14]; - temp_1[1] = [[NSData alloc] initWithBytes:"octect_string_2" length:15]; - temp_1[2] = [[NSData alloc] initWithBytes:"octet_string_3" length:14]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).f = temp_1; - } - { - NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; - temp_1[0] = [NSNumber numberWithUnsignedChar:0]; - temp_1[1] = [NSNumber numberWithUnsignedChar:255]; - ((CHIPTestClusterClusterNestedStructList *) params.arg1).g = temp_1; - } - - [cluster testNestedStructListArgumentRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Send Test Command With Nested Struct List Argument and some fields b of " - @"arg1.d are false Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], false); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000159_SimpleStructEchoRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With Struct Argument and see what we get back"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterSimpleStructEchoRequestParams alloc] init]; - params.arg1 = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).a = [NSNumber numberWithUnsignedChar:17]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).b = [NSNumber numberWithBool:false]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).c = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).d = [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).g = [NSNumber numberWithFloat:0.1f]; - ((CHIPTestClusterClusterSimpleStruct *) params.arg1).h = [NSNumber numberWithDouble:0.1]; - - [cluster simpleStructEchoRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterSimpleStructResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Command With Struct Argument and see what we get back Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.arg1; - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).a unsignedCharValue], 17); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).b boolValue], false); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).c unsignedCharValue], 2); - XCTAssertTrue([((CHIPTestClusterClusterSimpleStruct *) actualValue).d - isEqualToData:[[NSData alloc] initWithBytes:"octet_string" length:12]]); - XCTAssertTrue( - [((CHIPTestClusterClusterSimpleStruct *) actualValue).e isEqualToString:@"char_string"]); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).f unsignedCharValue], 1); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).g floatValue], 0.1f); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).h doubleValue], 0.1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000160_TestListInt8UArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With List of INT8U and none of them is set to 0"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestListInt8UArgumentRequestParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [NSNumber numberWithUnsignedChar:1]; - temp_0[1] = [NSNumber numberWithUnsignedChar:2]; - temp_0[2] = [NSNumber numberWithUnsignedChar:3]; - temp_0[3] = [NSNumber numberWithUnsignedChar:4]; - temp_0[4] = [NSNumber numberWithUnsignedChar:5]; - temp_0[5] = [NSNumber numberWithUnsignedChar:6]; - temp_0[6] = [NSNumber numberWithUnsignedChar:7]; - temp_0[7] = [NSNumber numberWithUnsignedChar:8]; - temp_0[8] = [NSNumber numberWithUnsignedChar:9]; - params.arg1 = temp_0; - } - [cluster testListInt8UArgumentRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterBooleanResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Command With List of INT8U and none of them is set to 0 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], true); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000161_TestListInt8UArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With List of INT8U and one of them is set to 0"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestListInt8UArgumentRequestParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [NSNumber numberWithUnsignedChar:1]; - temp_0[1] = [NSNumber numberWithUnsignedChar:2]; - temp_0[2] = [NSNumber numberWithUnsignedChar:3]; - temp_0[3] = [NSNumber numberWithUnsignedChar:4]; - temp_0[4] = [NSNumber numberWithUnsignedChar:5]; - temp_0[5] = [NSNumber numberWithUnsignedChar:6]; - temp_0[6] = [NSNumber numberWithUnsignedChar:7]; - temp_0[7] = [NSNumber numberWithUnsignedChar:8]; - temp_0[8] = [NSNumber numberWithUnsignedChar:9]; - temp_0[9] = [NSNumber numberWithUnsignedChar:0]; - params.arg1 = temp_0; - } - [cluster testListInt8UArgumentRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterBooleanResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Command With List of INT8U and one of them is set to 0 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], false); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000162_TestListInt8UReverseRequest -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Command With List of INT8U and get it reversed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestListInt8UReverseRequestParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [NSNumber numberWithUnsignedChar:1]; - temp_0[1] = [NSNumber numberWithUnsignedChar:2]; - temp_0[2] = [NSNumber numberWithUnsignedChar:3]; - temp_0[3] = [NSNumber numberWithUnsignedChar:4]; - temp_0[4] = [NSNumber numberWithUnsignedChar:5]; - temp_0[5] = [NSNumber numberWithUnsignedChar:6]; - temp_0[6] = [NSNumber numberWithUnsignedChar:7]; - temp_0[7] = [NSNumber numberWithUnsignedChar:8]; - temp_0[8] = [NSNumber numberWithUnsignedChar:9]; - params.arg1 = temp_0; - } - [cluster testListInt8UReverseRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterTestListInt8UReverseResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Send Test Command With List of INT8U and get it reversed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.arg1; - XCTAssertEqual([actualValue count], 9); - XCTAssertEqual([actualValue[0] unsignedCharValue], 9); - XCTAssertEqual([actualValue[1] unsignedCharValue], 8); - XCTAssertEqual([actualValue[2] unsignedCharValue], 7); - XCTAssertEqual([actualValue[3] unsignedCharValue], 6); - XCTAssertEqual([actualValue[4] unsignedCharValue], 5); - XCTAssertEqual([actualValue[5] unsignedCharValue], 4); - XCTAssertEqual([actualValue[6] unsignedCharValue], 3); - XCTAssertEqual([actualValue[7] unsignedCharValue], 2); - XCTAssertEqual([actualValue[8] unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000163_TestListInt8UReverseRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With empty List of INT8U and get an empty list back"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestListInt8UReverseRequestParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - params.arg1 = temp_0; - } - [cluster testListInt8UReverseRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterTestListInt8UReverseResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Send Test Command With empty List of INT8U and get an empty list back Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.arg1; - XCTAssertEqual([actualValue count], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000164_TestListStructArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With List of Struct Argument and arg1.b of first item is true"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestListStructArgumentRequestParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).c = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).d = [[NSData alloc] initWithBytes:"first_octet_string" length:18]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).e = @"first_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).h = [NSNumber numberWithDouble:0]; - - temp_0[1] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).a = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).d = [[NSData alloc] initWithBytes:"second_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).e = @"second_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).h = [NSNumber numberWithDouble:0]; - - params.arg1 = temp_0; - } - [cluster - testListStructArgumentRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterBooleanResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog( - @"Send Test Command With List of Struct Argument and arg1.b of first item is true Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], true); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000165_TestListStructArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send Test Command With List of Struct Argument and arg1.b of first item is false"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestListStructArgumentRequestParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).a = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).d = [[NSData alloc] initWithBytes:"second_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).e = @"second_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[0]).h = [NSNumber numberWithDouble:0]; - - temp_0[1] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).b = [NSNumber numberWithBool:false]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).c = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).d = [[NSData alloc] initWithBytes:"first_octet_string" length:18]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).e = @"first_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_0[1]).h = [NSNumber numberWithDouble:0]; - - params.arg1 = temp_0; - } - [cluster - testListStructArgumentRequestWithParams:params - completionHandler:^( - CHIPTestClusterClusterBooleanResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog( - @"Send Test Command With List of Struct Argument and arg1.b of first item is false Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], false); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000166_TestListNestedStructListArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Send Test Command With List of Nested Struct List Argument and all fields b of elements of arg1.d are true"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestListNestedStructListArgumentRequestParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPTestClusterClusterNestedStructList alloc] init]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).a = - [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).b = - [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).c = - [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).d = - [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).f = - [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).g = - [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).h = - [NSNumber numberWithDouble:0]; - - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).a = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).d = [[NSData alloc] initWithBytes:"nested_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).e = @"nested_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).h = [NSNumber numberWithDouble:0]; - - temp_2[1] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).a = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).d = [[NSData alloc] initWithBytes:"nested_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).e = @"nested_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).h = [NSNumber numberWithDouble:0]; - - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).d = temp_2; - } - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [NSNumber numberWithUnsignedInt:1UL]; - temp_2[1] = [NSNumber numberWithUnsignedInt:2UL]; - temp_2[2] = [NSNumber numberWithUnsignedInt:3UL]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).e = temp_2; - } - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [[NSData alloc] initWithBytes:"octet_string_1" length:14]; - temp_2[1] = [[NSData alloc] initWithBytes:"octect_string_2" length:15]; - temp_2[2] = [[NSData alloc] initWithBytes:"octet_string_3" length:14]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).f = temp_2; - } - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [NSNumber numberWithUnsignedChar:0]; - temp_2[1] = [NSNumber numberWithUnsignedChar:255]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).g = temp_2; - } - - params.arg1 = temp_0; - } - [cluster testListNestedStructListArgumentRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Send Test Command With List of Nested Struct List Argument and all fields " - @"b of elements of arg1.d are true Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], true); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000167_TestListNestedStructListArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Send Test Command With Nested Struct List Argument and some fields b of elements of arg1.d are false"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestListNestedStructListArgumentRequestParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPTestClusterClusterNestedStructList alloc] init]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).a = [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).a = - [NSNumber numberWithUnsignedChar:0]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).b = - [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).c = - [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).d = - [[NSData alloc] initWithBytes:"octet_string" length:12]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).e = @"char_string"; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).f = - [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).g = - [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).c).h = - [NSNumber numberWithDouble:0]; - - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).a = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).d = [[NSData alloc] initWithBytes:"nested_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).e = @"nested_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[0]).h = [NSNumber numberWithDouble:0]; - - temp_2[1] = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).a = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).b = [NSNumber numberWithBool:false]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).c = [NSNumber numberWithUnsignedChar:3]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).d = [[NSData alloc] initWithBytes:"nested_octet_string" length:19]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).e = @"nested_char_string"; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).f = [NSNumber numberWithUnsignedChar:1]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).g = [NSNumber numberWithFloat:0.0f]; - ((CHIPTestClusterClusterSimpleStruct *) temp_2[1]).h = [NSNumber numberWithDouble:0]; - - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).d = temp_2; - } - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [NSNumber numberWithUnsignedInt:1UL]; - temp_2[1] = [NSNumber numberWithUnsignedInt:2UL]; - temp_2[2] = [NSNumber numberWithUnsignedInt:3UL]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).e = temp_2; - } - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [[NSData alloc] initWithBytes:"octet_string_1" length:14]; - temp_2[1] = [[NSData alloc] initWithBytes:"octect_string_2" length:15]; - temp_2[2] = [[NSData alloc] initWithBytes:"octet_string_3" length:14]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).f = temp_2; - } - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [NSNumber numberWithUnsignedChar:0]; - temp_2[1] = [NSNumber numberWithUnsignedChar:255]; - ((CHIPTestClusterClusterNestedStructList *) temp_0[0]).g = temp_2; - } - - params.arg1 = temp_0; - } - [cluster testListNestedStructListArgumentRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterBooleanResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Send Test Command With Nested Struct List Argument and some fields b of " - @"elements of arg1.d are false Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.value; - XCTAssertEqual([actualValue boolValue], false); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000168_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write attribute LIST With List of INT8U and none of them is set to 0"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id listInt8uArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [NSNumber numberWithUnsignedChar:1]; - temp_0[1] = [NSNumber numberWithUnsignedChar:2]; - temp_0[2] = [NSNumber numberWithUnsignedChar:3]; - temp_0[3] = [NSNumber numberWithUnsignedChar:4]; - listInt8uArgument = temp_0; - } - [cluster writeAttributeListInt8uWithValue:listInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute LIST With List of INT8U and none of them is set to 0 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000169_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST With List of INT8U"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListInt8uWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LIST With List of INT8U Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 4); - XCTAssertEqual([actualValue[0] unsignedCharValue], 1); - XCTAssertEqual([actualValue[1] unsignedCharValue], 2); - XCTAssertEqual([actualValue[2] unsignedCharValue], 3); - XCTAssertEqual([actualValue[3] unsignedCharValue], 4); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000170_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LIST With List of OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id listOctetStringArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[NSData alloc] initWithBytes:"Test0" length:5]; - temp_0[1] = [[NSData alloc] initWithBytes:"Test1" length:5]; - temp_0[2] = [[NSData alloc] initWithBytes:"Test2" length:5]; - temp_0[3] = [[NSData alloc] initWithBytes:"Test3" length:5]; - listOctetStringArgument = temp_0; - } - [cluster writeAttributeListOctetStringWithValue:listOctetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute LIST With List of OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000171_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST With List of OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListOctetStringWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LIST With List of OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 4); - XCTAssertTrue([actualValue[0] isEqualToData:[[NSData alloc] initWithBytes:"Test0" length:5]]); - XCTAssertTrue([actualValue[1] isEqualToData:[[NSData alloc] initWithBytes:"Test1" length:5]]); - XCTAssertTrue([actualValue[2] isEqualToData:[[NSData alloc] initWithBytes:"Test2" length:5]]); - XCTAssertTrue([actualValue[3] isEqualToData:[[NSData alloc] initWithBytes:"Test3" length:5]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000172_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write attribute LIST With List of LIST_STRUCT_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id listStructOctetStringArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPTestClusterClusterTestListStructOctet alloc] init]; - ((CHIPTestClusterClusterTestListStructOctet *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedLongLong:0ULL]; - ((CHIPTestClusterClusterTestListStructOctet *) temp_0[0]).operationalCert = [[NSData alloc] initWithBytes:"Test0" length:5]; - - temp_0[1] = [[CHIPTestClusterClusterTestListStructOctet alloc] init]; - ((CHIPTestClusterClusterTestListStructOctet *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedLongLong:1ULL]; - ((CHIPTestClusterClusterTestListStructOctet *) temp_0[1]).operationalCert = [[NSData alloc] initWithBytes:"Test1" length:5]; - - temp_0[2] = [[CHIPTestClusterClusterTestListStructOctet alloc] init]; - ((CHIPTestClusterClusterTestListStructOctet *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedLongLong:2ULL]; - ((CHIPTestClusterClusterTestListStructOctet *) temp_0[2]).operationalCert = [[NSData alloc] initWithBytes:"Test2" length:5]; - - temp_0[3] = [[CHIPTestClusterClusterTestListStructOctet alloc] init]; - ((CHIPTestClusterClusterTestListStructOctet *) temp_0[3]).fabricIndex = [NSNumber numberWithUnsignedLongLong:3ULL]; - ((CHIPTestClusterClusterTestListStructOctet *) temp_0[3]).operationalCert = [[NSData alloc] initWithBytes:"Test3" length:5]; - - listStructOctetStringArgument = temp_0; - } - [cluster writeAttributeListStructOctetStringWithValue:listStructOctetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute LIST With List of LIST_STRUCT_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000173_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute LIST With List of LIST_STRUCT_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListStructOctetStringWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute LIST With List of LIST_STRUCT_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 4); - XCTAssertEqual( - [((CHIPTestClusterClusterTestListStructOctet *) actualValue[0]).fabricIndex unsignedLongLongValue], 0ULL); - XCTAssertTrue([((CHIPTestClusterClusterTestListStructOctet *) actualValue[0]).operationalCert - isEqualToData:[[NSData alloc] initWithBytes:"Test0" length:5]]); - XCTAssertEqual( - [((CHIPTestClusterClusterTestListStructOctet *) actualValue[1]).fabricIndex unsignedLongLongValue], 1ULL); - XCTAssertTrue([((CHIPTestClusterClusterTestListStructOctet *) actualValue[1]).operationalCert - isEqualToData:[[NSData alloc] initWithBytes:"Test1" length:5]]); - XCTAssertEqual( - [((CHIPTestClusterClusterTestListStructOctet *) actualValue[2]).fabricIndex unsignedLongLongValue], 2ULL); - XCTAssertTrue([((CHIPTestClusterClusterTestListStructOctet *) actualValue[2]).operationalCert - isEqualToData:[[NSData alloc] initWithBytes:"Test2" length:5]]); - XCTAssertEqual( - [((CHIPTestClusterClusterTestListStructOctet *) actualValue[3]).fabricIndex unsignedLongLongValue], 3ULL); - XCTAssertTrue([((CHIPTestClusterClusterTestListStructOctet *) actualValue[3]).operationalCert - isEqualToData:[[NSData alloc] initWithBytes:"Test3" length:5]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000174_TestNullableOptionalRequest -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Command with optional arg set."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestNullableOptionalRequestParams alloc] init]; - params.arg1 = [NSNumber numberWithUnsignedChar:5]; - [cluster testNullableOptionalRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterTestNullableOptionalResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Send Test Command with optional arg set. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.wasPresent; - XCTAssertEqual([actualValue boolValue], true); - } - { - id actualValue = values.wasNull; - XCTAssertEqual([actualValue boolValue], false); - } - { - id actualValue = values.value; - XCTAssertEqual([actualValue unsignedCharValue], 5); - } - { - id actualValue = values.originalValue; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 5); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000175_TestNullableOptionalRequest -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Command without its optional arg."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestNullableOptionalRequestParams alloc] init]; - [cluster testNullableOptionalRequestWithParams:params - completionHandler:^(CHIPTestClusterClusterTestNullableOptionalResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Send Test Command without its optional arg. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.wasPresent; - XCTAssertEqual([actualValue boolValue], false); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000176_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read list of structs containing nullables and optionals"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeListNullablesAndOptionalsStructWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read list of structs containing nullables and optionals Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertTrue(((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableInt == nil); - XCTAssertTrue(((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableString == nil); - XCTAssertTrue(((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableStruct == nil); - XCTAssertTrue(((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableList == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000177_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write list of structs containing nullables and optionals"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id listNullablesAndOptionalsStructArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPTestClusterClusterNullablesAndOptionalsStruct alloc] init]; - ((CHIPTestClusterClusterNullablesAndOptionalsStruct *) temp_0[0]).nullableInt = nil; - ((CHIPTestClusterClusterNullablesAndOptionalsStruct *) temp_0[0]).nullableString = nil; - ((CHIPTestClusterClusterNullablesAndOptionalsStruct *) temp_0[0]).nullableStruct = nil; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedChar:1]; - temp_3[1] = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterNullablesAndOptionalsStruct *) temp_0[0]).nullableList = temp_3; - } - - listNullablesAndOptionalsStructArgument = temp_0; - } - [cluster - writeAttributeListNullablesAndOptionalsStructWithValue:listNullablesAndOptionalsStructArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write list of structs containing nullables and optionals Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000178_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read list of structs containing nullables and optionals after writing"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeListNullablesAndOptionalsStructWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read list of structs containing nullables and optionals after writing Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertTrue(((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableInt == nil); - XCTAssertTrue(((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableString == nil); - XCTAssertTrue(((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableStruct == nil); - XCTAssertFalse(((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableList == nil); - XCTAssertEqual([((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableList count], 2); - XCTAssertEqual( - [((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableList[0] unsignedCharValue], 1); - XCTAssertEqual( - [((CHIPTestClusterClusterNullablesAndOptionalsStruct *) actualValue[0]).nullableList[1] unsignedCharValue], 2); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000179_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BOOLEAN null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBooleanArgument; - nullableBooleanArgument = nil; - [cluster writeAttributeNullableBooleanWithValue:nullableBooleanArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BOOLEAN null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000180_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BOOLEAN null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BOOLEAN null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000181_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BOOLEAN True"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBooleanArgument; - nullableBooleanArgument = [NSNumber numberWithBool:true]; - [cluster writeAttributeNullableBooleanWithValue:nullableBooleanArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BOOLEAN True Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000182_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BOOLEAN True"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BOOLEAN True Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue boolValue], true); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000183_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP8 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap8Argument; - nullableBitmap8Argument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeNullableBitmap8WithValue:nullableBitmap8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP8 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000184_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP8 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP8 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000185_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP8 Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap8Argument; - nullableBitmap8Argument = [NSNumber numberWithUnsignedChar:255]; - [cluster - writeAttributeNullableBitmap8WithValue:nullableBitmap8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP8 Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000186_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP8 unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP8 unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000187_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP8 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap8Argument; - nullableBitmap8Argument = nil; - [cluster writeAttributeNullableBitmap8WithValue:nullableBitmap8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP8 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000188_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP8 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP8 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000189_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP16 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap16Argument; - nullableBitmap16Argument = [NSNumber numberWithUnsignedShort:65534U]; - [cluster writeAttributeNullableBitmap16WithValue:nullableBitmap16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP16 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000190_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP16 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP16 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 65534U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000191_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP16 Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap16Argument; - nullableBitmap16Argument = [NSNumber numberWithUnsignedShort:65535U]; - [cluster - writeAttributeNullableBitmap16WithValue:nullableBitmap16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP16 Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000192_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP16 unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP16 unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 65534U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000193_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP16 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap16Argument; - nullableBitmap16Argument = nil; - [cluster writeAttributeNullableBitmap16WithValue:nullableBitmap16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP16 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000194_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP16 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP16 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000195_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP32 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap32Argument; - nullableBitmap32Argument = [NSNumber numberWithUnsignedInt:4294967294UL]; - [cluster writeAttributeNullableBitmap32WithValue:nullableBitmap32Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP32 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000196_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP32 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP32 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 4294967294UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000197_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP32 Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap32Argument; - nullableBitmap32Argument = [NSNumber numberWithUnsignedInt:4294967295UL]; - [cluster - writeAttributeNullableBitmap32WithValue:nullableBitmap32Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP32 Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000198_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP32 unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP32 unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 4294967294UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000199_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP32 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap32Argument; - nullableBitmap32Argument = nil; - [cluster writeAttributeNullableBitmap32WithValue:nullableBitmap32Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP32 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000200_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP32 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP32 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000201_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP64 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap64Argument; - nullableBitmap64Argument = [NSNumber numberWithUnsignedLongLong:18446744073709551614ULL]; - [cluster writeAttributeNullableBitmap64WithValue:nullableBitmap64Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP64 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000202_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP64 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP64 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedLongLongValue], 18446744073709551614ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000203_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP64 Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap64Argument; - nullableBitmap64Argument = [NSNumber numberWithUnsignedLongLong:18446744073709551615ULL]; - [cluster - writeAttributeNullableBitmap64WithValue:nullableBitmap64Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP64 Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000204_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP64 unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP64 unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedLongLongValue], 18446744073709551614ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000205_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_BITMAP64 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableBitmap64Argument; - nullableBitmap64Argument = nil; - [cluster writeAttributeNullableBitmap64WithValue:nullableBitmap64Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_BITMAP64 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000206_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_BITMAP64 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_BITMAP64 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000207_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8uArgument; - nullableInt8uArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeNullableInt8uWithValue:nullableInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000208_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000209_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8uArgument; - nullableInt8uArgument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeNullableInt8uWithValue:nullableInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000210_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000211_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8U Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8uArgument; - nullableInt8uArgument = [NSNumber numberWithUnsignedChar:255]; - [cluster writeAttributeNullableInt8uWithValue:nullableInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8U Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000212_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8U unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000213_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute NULLABLE_INT8U unchanged Value with constraint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U unchanged Value with constraint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000214_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8U null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8uArgument; - nullableInt8uArgument = nil; - [cluster writeAttributeNullableInt8uWithValue:nullableInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8U null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000215_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8U null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000216_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8U null Value & range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U null Value & range 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], 254); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000217_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8U null Value & not"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U null Value & not Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 254); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000218_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8U Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8uArgument; - nullableInt8uArgument = [NSNumber numberWithUnsignedChar:128]; - [cluster writeAttributeNullableInt8uWithValue:nullableInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8U Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000219_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8U Value in range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U Value in range 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], 254); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000220_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8U notValue OK"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8U notValue OK Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 129); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000221_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16uArgument; - nullableInt16uArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeNullableInt16uWithValue:nullableInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000222_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000223_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16uArgument; - nullableInt16uArgument = [NSNumber numberWithUnsignedShort:65534U]; - [cluster writeAttributeNullableInt16uWithValue:nullableInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000224_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 65534U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000225_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16U Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16uArgument; - nullableInt16uArgument = [NSNumber numberWithUnsignedShort:65535U]; - [cluster - writeAttributeNullableInt16uWithValue:nullableInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16U Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000226_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16U unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16U unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 65534U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000227_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16U null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16uArgument; - nullableInt16uArgument = nil; - [cluster writeAttributeNullableInt16uWithValue:nullableInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16U null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000228_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16U null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16U null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000229_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16U null Value & range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16U null Value & range 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], 65534U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000230_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16U null Value & not"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16U null Value & not Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 65534U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000231_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16U Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16uArgument; - nullableInt16uArgument = [NSNumber numberWithUnsignedShort:32000U]; - [cluster writeAttributeNullableInt16uWithValue:nullableInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16U Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000232_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16U Value in range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16U Value in range 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], 65534U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000233_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16U notValue OK"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16U notValue OK Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], 32001U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000234_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32uArgument; - nullableInt32uArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeNullableInt32uWithValue:nullableInt32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000235_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000236_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32uArgument; - nullableInt32uArgument = [NSNumber numberWithUnsignedInt:4294967294UL]; - [cluster writeAttributeNullableInt32uWithValue:nullableInt32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000237_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 4294967294UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000238_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32U Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32uArgument; - nullableInt32uArgument = [NSNumber numberWithUnsignedInt:4294967295UL]; - [cluster - writeAttributeNullableInt32uWithValue:nullableInt32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32U Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000239_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32U unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32U unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedIntValue], 4294967294UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000240_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32U null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32uArgument; - nullableInt32uArgument = nil; - [cluster writeAttributeNullableInt32uWithValue:nullableInt32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32U null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000241_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32U null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32U null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000242_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32U null Value & range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32U null Value & range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedIntValue], 0UL); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedIntValue], 4294967294UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000243_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32U null Value & not"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32U null Value & not Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedIntValue], 4294967294UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000244_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32U Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32uArgument; - nullableInt32uArgument = [NSNumber numberWithUnsignedInt:2147483647UL]; - [cluster writeAttributeNullableInt32uWithValue:nullableInt32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32U Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000245_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32U Value in range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32U Value in range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedIntValue], 0UL); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedIntValue], 4294967294UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000246_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32U notValue OK"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32U notValue OK Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedIntValue], 2147483648UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000247_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64uArgument; - nullableInt64uArgument = [NSNumber numberWithUnsignedLongLong:0ULL]; - [cluster writeAttributeNullableInt64uWithValue:nullableInt64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000248_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64U Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64U Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000249_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64uArgument; - nullableInt64uArgument = [NSNumber numberWithUnsignedLongLong:18446744073709551614ULL]; - [cluster writeAttributeNullableInt64uWithValue:nullableInt64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000250_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64U Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64U Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedLongLongValue], 18446744073709551614ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000251_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64U Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64uArgument; - nullableInt64uArgument = [NSNumber numberWithUnsignedLongLong:18446744073709551615ULL]; - [cluster - writeAttributeNullableInt64uWithValue:nullableInt64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64U Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000252_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64U unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64U unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedLongLongValue], 18446744073709551614ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000253_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64U null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64uArgument; - nullableInt64uArgument = nil; - [cluster writeAttributeNullableInt64uWithValue:nullableInt64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64U null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000254_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64U null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64U null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000255_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64U null Value & range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64U null Value & range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedLongLongValue], 0ULL); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedLongLongValue], 18446744073709551614ULL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000256_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64U null Value & not"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64U null Value & not Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedLongLongValue], 18446744073709551614ULL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000257_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64U Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64uArgument; - nullableInt64uArgument = [NSNumber numberWithUnsignedLongLong:18000000000000000000ULL]; - [cluster writeAttributeNullableInt64uWithValue:nullableInt64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64U Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000258_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64U Value in range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64U Value in range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedLongLongValue], 0ULL); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedLongLongValue], 18446744073709551614ULL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000259_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64U notValue OK"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64U notValue OK Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedLongLongValue], 18000000000000000001ULL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000260_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8sArgument; - nullableInt8sArgument = [NSNumber numberWithChar:-127]; - [cluster writeAttributeNullableInt8sWithValue:nullableInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000261_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue charValue], -127); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000262_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8S Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8sArgument; - nullableInt8sArgument = [NSNumber numberWithChar:-128]; - [cluster writeAttributeNullableInt8sWithValue:nullableInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8S Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000263_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8S unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8S unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue charValue], -127); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000264_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8S null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8sArgument; - nullableInt8sArgument = nil; - [cluster writeAttributeNullableInt8sWithValue:nullableInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8S null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000265_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8S null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8S null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000266_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8S null Value & range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8S null Value & range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue charValue], -127); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue charValue], 127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000267_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8S null Value & not"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8S null Value & not Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue charValue], -127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000268_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT8S Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt8sArgument; - nullableInt8sArgument = [NSNumber numberWithChar:-127]; - [cluster writeAttributeNullableInt8sWithValue:nullableInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT8S Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000269_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8S Value in range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8S Value in range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue charValue], -127); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue charValue], 127); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000270_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT8S notValue OK"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT8S notValue OK Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue charValue], -126); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000271_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16sArgument; - nullableInt16sArgument = [NSNumber numberWithShort:-32767]; - [cluster writeAttributeNullableInt16sWithValue:nullableInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000272_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], -32767); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000273_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16S Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16sArgument; - nullableInt16sArgument = [NSNumber numberWithShort:-32768]; - [cluster - writeAttributeNullableInt16sWithValue:nullableInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16S Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000274_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16S unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16S unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], -32767); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000275_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16S null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16sArgument; - nullableInt16sArgument = nil; - [cluster writeAttributeNullableInt16sWithValue:nullableInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16S null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000276_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16S null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16S null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000277_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16S null Value & range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16S null Value & range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -32767); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 32767); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000278_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16S null Value & not"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16S null Value & not Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue shortValue], -32767); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000279_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT16S Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt16sArgument; - nullableInt16sArgument = [NSNumber numberWithShort:-32767]; - [cluster writeAttributeNullableInt16sWithValue:nullableInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT16S Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000280_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16S Value in range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16S Value in range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], -32767); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 32767); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000281_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT16S notValue OK"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT16S notValue OK Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue shortValue], -32766); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000282_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32sArgument; - nullableInt32sArgument = [NSNumber numberWithInt:-2147483647L]; - [cluster writeAttributeNullableInt32sWithValue:nullableInt32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000283_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue intValue], -2147483647L); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000284_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32S Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32sArgument; - nullableInt32sArgument = [NSNumber numberWithInt:-2147483648L]; - [cluster - writeAttributeNullableInt32sWithValue:nullableInt32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32S Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000285_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32S unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32S unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue intValue], -2147483647L); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000286_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32S null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32sArgument; - nullableInt32sArgument = nil; - [cluster writeAttributeNullableInt32sWithValue:nullableInt32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32S null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000287_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32S null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32S null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000288_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32S null Value & range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32S null Value & range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue intValue], -2147483647L); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue intValue], 2147483647L); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000289_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32S null Value & not"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32S null Value & not Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue intValue], -2147483647L); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000290_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT32S Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt32sArgument; - nullableInt32sArgument = [NSNumber numberWithInt:-2147483647L]; - [cluster writeAttributeNullableInt32sWithValue:nullableInt32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT32S Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000291_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32S Value in range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32S Value in range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue intValue], -2147483647L); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue intValue], 2147483647L); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000292_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT32S notValue OK"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT32S notValue OK Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue intValue], -2147483646L); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000293_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64sArgument; - nullableInt64sArgument = [NSNumber numberWithLongLong:-9223372036854775807LL]; - [cluster writeAttributeNullableInt64sWithValue:nullableInt64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000294_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64S Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64S Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue longLongValue], -9223372036854775807LL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000295_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64S Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64sArgument; - nullableInt64sArgument = [NSNumber numberWithLongLong:-9223372036854775807LL - 1]; - [cluster - writeAttributeNullableInt64sWithValue:nullableInt64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64S Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000296_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64S unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64S unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue longLongValue], -9223372036854775807LL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000297_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64S null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64sArgument; - nullableInt64sArgument = nil; - [cluster writeAttributeNullableInt64sWithValue:nullableInt64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64S null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000298_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64S null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64S null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000299_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64S null Value & range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64S null Value & range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue longLongValue], -9223372036854775807LL); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue longLongValue], 9223372036854775807LL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000300_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64S null Value & not"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64S null Value & not Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue longLongValue], -9223372036854775807LL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000301_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_INT64S Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableInt64sArgument; - nullableInt64sArgument = [NSNumber numberWithLongLong:-9223372036854775807LL]; - [cluster writeAttributeNullableInt64sWithValue:nullableInt64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_INT64S Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000302_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64S Value in range"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64S Value in range Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue longLongValue], -9223372036854775807LL); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue longLongValue], 9223372036854775807LL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000303_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_INT64S notValue OK"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_INT64S notValue OK Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue longLongValue], -9223372036854775806LL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000304_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SINGLE medium Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatSingleArgument; - nullableFloatSingleArgument = [NSNumber numberWithFloat:0.1f]; - [cluster writeAttributeNullableFloatSingleWithValue:nullableFloatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SINGLE medium Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000305_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SINGLE medium Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SINGLE medium Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue floatValue], 0.1f); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000306_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SINGLE largest Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatSingleArgument; - nullableFloatSingleArgument = [NSNumber numberWithFloat:INFINITY]; - [cluster writeAttributeNullableFloatSingleWithValue:nullableFloatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SINGLE largest Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000307_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SINGLE largest Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SINGLE largest Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue floatValue], INFINITY); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000308_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SINGLE smallest Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatSingleArgument; - nullableFloatSingleArgument = [NSNumber numberWithFloat:-INFINITY]; - [cluster writeAttributeNullableFloatSingleWithValue:nullableFloatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SINGLE smallest Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000309_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SINGLE smallest Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SINGLE smallest Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue floatValue], -INFINITY); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000310_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SINGLE null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatSingleArgument; - nullableFloatSingleArgument = nil; - [cluster writeAttributeNullableFloatSingleWithValue:nullableFloatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SINGLE null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000311_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SINGLE null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SINGLE null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000312_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SINGLE 0 Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatSingleArgument; - nullableFloatSingleArgument = [NSNumber numberWithFloat:0.0f]; - [cluster writeAttributeNullableFloatSingleWithValue:nullableFloatSingleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SINGLE 0 Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000313_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SINGLE 0 Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatSingleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SINGLE 0 Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue floatValue], 0.0f); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000314_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_DOUBLE medium Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatDoubleArgument; - nullableFloatDoubleArgument = [NSNumber numberWithDouble:0.1234567890123]; - [cluster writeAttributeNullableFloatDoubleWithValue:nullableFloatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_DOUBLE medium Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000315_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_DOUBLE medium Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_DOUBLE medium Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue doubleValue], 0.1234567890123); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000316_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_DOUBLE largest Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatDoubleArgument; - nullableFloatDoubleArgument = [NSNumber numberWithDouble:INFINITY]; - [cluster writeAttributeNullableFloatDoubleWithValue:nullableFloatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_DOUBLE largest Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000317_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_DOUBLE largest Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_DOUBLE largest Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue doubleValue], INFINITY); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000318_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_DOUBLE smallest Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatDoubleArgument; - nullableFloatDoubleArgument = [NSNumber numberWithDouble:-INFINITY]; - [cluster writeAttributeNullableFloatDoubleWithValue:nullableFloatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_DOUBLE smallest Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000319_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_DOUBLE smallest Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_DOUBLE smallest Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue doubleValue], -INFINITY); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000320_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_DOUBLE null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatDoubleArgument; - nullableFloatDoubleArgument = nil; - [cluster writeAttributeNullableFloatDoubleWithValue:nullableFloatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_DOUBLE null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000321_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_DOUBLE null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_DOUBLE null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000322_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_DOUBLE 0 Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableFloatDoubleArgument; - nullableFloatDoubleArgument = [NSNumber numberWithDouble:0]; - [cluster writeAttributeNullableFloatDoubleWithValue:nullableFloatDoubleArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_DOUBLE 0 Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000323_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_DOUBLE 0 Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableFloatDoubleWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_DOUBLE 0 Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue doubleValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000324_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_ENUM8 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnum8Argument; - nullableEnum8Argument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeNullableEnum8WithValue:nullableEnum8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_ENUM8 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000325_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_ENUM8 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_ENUM8 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000326_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_ENUM8 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnum8Argument; - nullableEnum8Argument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeNullableEnum8WithValue:nullableEnum8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_ENUM8 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000327_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_ENUM8 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_ENUM8 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000328_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_ENUM8 Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnum8Argument; - nullableEnum8Argument = [NSNumber numberWithUnsignedChar:255]; - [cluster writeAttributeNullableEnum8WithValue:nullableEnum8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_ENUM8 Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000329_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_ENUM8 unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_ENUM8 unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000330_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_ENUM8 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnum8Argument; - nullableEnum8Argument = nil; - [cluster writeAttributeNullableEnum8WithValue:nullableEnum8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_ENUM8 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000331_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_ENUM8 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_ENUM8 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000332_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_ENUM16 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnum16Argument; - nullableEnum16Argument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeNullableEnum16WithValue:nullableEnum16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_ENUM16 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000333_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_ENUM16 Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_ENUM16 Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000334_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_ENUM16 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnum16Argument; - nullableEnum16Argument = [NSNumber numberWithUnsignedShort:65534U]; - [cluster writeAttributeNullableEnum16WithValue:nullableEnum16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_ENUM16 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000335_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_ENUM16 Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_ENUM16 Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 65534U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000336_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_ENUM16 Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnum16Argument; - nullableEnum16Argument = [NSNumber numberWithUnsignedShort:65535U]; - [cluster - writeAttributeNullableEnum16WithValue:nullableEnum16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_ENUM16 Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000337_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_ENUM16 unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_ENUM16 unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 65534U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000338_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_ENUM16 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnum16Argument; - nullableEnum16Argument = nil; - [cluster writeAttributeNullableEnum16WithValue:nullableEnum16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_ENUM16 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000339_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_ENUM16 null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_ENUM16 null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000340_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SIMPLE_ENUM Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnumAttrArgument; - nullableEnumAttrArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeNullableEnumAttrWithValue:nullableEnumAttrArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SIMPLE_ENUM Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000341_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SIMPLE_ENUM Min Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnumAttrWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SIMPLE_ENUM Min Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000342_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SIMPLE_ENUM Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnumAttrArgument; - nullableEnumAttrArgument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeNullableEnumAttrWithValue:nullableEnumAttrArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SIMPLE_ENUM Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000343_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SIMPLE_ENUM Max Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnumAttrWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SIMPLE_ENUM Max Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000344_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SIMPLE_ENUM Invalid Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnumAttrArgument; - nullableEnumAttrArgument = [NSNumber numberWithUnsignedChar:255]; - [cluster - writeAttributeNullableEnumAttrWithValue:nullableEnumAttrArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SIMPLE_ENUM Invalid Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000345_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SIMPLE_ENUM unchanged Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnumAttrWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SIMPLE_ENUM unchanged Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000346_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_SIMPLE_ENUM null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableEnumAttrArgument; - nullableEnumAttrArgument = nil; - [cluster writeAttributeNullableEnumAttrWithValue:nullableEnumAttrArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_SIMPLE_ENUM null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000347_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_SIMPLE_ENUM null Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableEnumAttrWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_SIMPLE_ENUM null Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000348_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_OCTET_STRING Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_OCTET_STRING Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"" length:0]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000349_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableOctetStringArgument; - nullableOctetStringArgument = [[NSData alloc] initWithBytes:"TestValue" length:9]; - [cluster writeAttributeNullableOctetStringWithValue:nullableOctetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000350_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"TestValue" length:9]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000351_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableOctetStringArgument; - nullableOctetStringArgument = nil; - [cluster writeAttributeNullableOctetStringWithValue:nullableOctetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000352_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000353_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableOctetStringArgument; - nullableOctetStringArgument = [[NSData alloc] initWithBytes:"" length:0]; - [cluster writeAttributeNullableOctetStringWithValue:nullableOctetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000354_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_OCTET_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_OCTET_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"" length:0]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000355_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_CHAR_STRING Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_CHAR_STRING Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertTrue([actualValue isEqualToString:@""]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000356_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableCharStringArgument; - nullableCharStringArgument = @"☉T☉"; - [cluster writeAttributeNullableCharStringWithValue:nullableCharStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000357_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertTrue([actualValue isEqualToString:@"☉T☉"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000358_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_CHAR_STRING - Value too long"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableCharStringArgument; - nullableCharStringArgument = nil; - [cluster writeAttributeNullableCharStringWithValue:nullableCharStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_CHAR_STRING - Value too long Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000359_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000360_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute NULLABLE_CHAR_STRING - Empty"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableCharStringArgument; - nullableCharStringArgument = @""; - [cluster writeAttributeNullableCharStringWithValue:nullableCharStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute NULLABLE_CHAR_STRING - Empty Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000361_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute NULLABLE_CHAR_STRING"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute NULLABLE_CHAR_STRING Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertTrue([actualValue isEqualToString:@""]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000362_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute from nonexistent endpoint."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:200 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListInt8uWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute from nonexistent endpoint. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000363_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute from nonexistent cluster."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListInt8uWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute from nonexistent cluster. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000364_TestSimpleOptionalArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send a command that takes an optional parameter but do not set it."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestSimpleOptionalArgumentRequestParams alloc] init]; - [cluster - testSimpleOptionalArgumentRequestWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Send a command that takes an optional parameter but do not set it. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_INVALID_VALUE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000365_TestSimpleOptionalArgumentRequest -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Send a command that takes an optional parameter but do not set it."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestSimpleOptionalArgumentRequestParams alloc] init]; - params.arg1 = [NSNumber numberWithBool:1]; - [cluster - testSimpleOptionalArgumentRequestWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Send a command that takes an optional parameter but do not set it. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -bool testSendClusterTestCluster_000366_WaitForReport_Fulfilled = false; -ResponseHandler test_TestCluster_list_int8u_Reported = nil; -- (void)testSendClusterTestCluster_000366_WaitForReport -{ - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - test_TestCluster_list_int8u_Reported = ^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Report: Subscribe to list attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 4); - XCTAssertEqual([actualValue[0] unsignedCharValue], 1); - XCTAssertEqual([actualValue[1] unsignedCharValue], 2); - XCTAssertEqual([actualValue[2] unsignedCharValue], 3); - XCTAssertEqual([actualValue[3] unsignedCharValue], 4); - } - - testSendClusterTestCluster_000366_WaitForReport_Fulfilled = true; - }; -} -- (void)testSendClusterTestCluster_000367_SubscribeAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Subscribe to list attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint16_t minIntervalArgument = 2U; - uint16_t maxIntervalArgument = 5U; - CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster subscribeAttributeListInt8uWithMinInterval:@(minIntervalArgument) - maxInterval:@(maxIntervalArgument) - params:params - subscriptionEstablished:^{ - XCTAssertEqual(testSendClusterTestCluster_000366_WaitForReport_Fulfilled, true); - [expectation fulfill]; - } - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Subscribe to list attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - if (test_TestCluster_list_int8u_Reported != nil) { - ResponseHandler callback = test_TestCluster_list_int8u_Reported; - test_TestCluster_list_int8u_Reported = nil; - callback(value, err); - } - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000368_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write subscribed-to list attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id listInt8uArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [NSNumber numberWithUnsignedChar:5]; - temp_0[1] = [NSNumber numberWithUnsignedChar:6]; - temp_0[2] = [NSNumber numberWithUnsignedChar:7]; - temp_0[3] = [NSNumber numberWithUnsignedChar:8]; - listInt8uArgument = temp_0; - } - [cluster writeAttributeListInt8uWithValue:listInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write subscribed-to list attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000369_WaitForReport -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check for list attribute report"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - test_TestCluster_list_int8u_Reported = ^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check for list attribute report Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 4); - XCTAssertEqual([actualValue[0] unsignedCharValue], 5); - XCTAssertEqual([actualValue[1] unsignedCharValue], 6); - XCTAssertEqual([actualValue[2] unsignedCharValue], 7); - XCTAssertEqual([actualValue[3] unsignedCharValue], 8); - } - - [expectation fulfill]; - }; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000370_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read range-restricted unsigned 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 70); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000371_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min value to a range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeRangeRestrictedInt8uWithValue:rangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min value to a range-restricted unsigned 8-bit integer Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000372_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-below-range value to a range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:19]; - [cluster - writeAttributeRangeRestrictedInt8uWithValue:rangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-below-range value to a range-restricted unsigned 8-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000373_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-above-range value to a range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:101]; - [cluster - writeAttributeRangeRestrictedInt8uWithValue:rangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-above-range value to a range-restricted unsigned 8-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000374_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max value to a range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:255]; - [cluster writeAttributeRangeRestrictedInt8uWithValue:rangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max value to a range-restricted unsigned 8-bit integer Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000375_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted unsigned 8-bit integer value has not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted unsigned 8-bit integer value has not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 70); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000376_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min valid value to a range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:20]; - [cluster - writeAttributeRangeRestrictedInt8uWithValue:rangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min valid value to a range-restricted unsigned 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000377_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted unsigned 8-bit integer value is at min valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted unsigned 8-bit integer value is at min valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 20); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000378_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max valid value to a range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:100]; - [cluster - writeAttributeRangeRestrictedInt8uWithValue:rangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max valid value to a range-restricted unsigned 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000379_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted unsigned 8-bit integer value is at max valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted unsigned 8-bit integer value is at max valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000380_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write middle valid value to a range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:50]; - [cluster writeAttributeRangeRestrictedInt8uWithValue:rangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write middle valid value to a range-restricted unsigned 8-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000381_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted unsigned 8-bit integer value is at mid valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted unsigned 8-bit integer value is at mid valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 50); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000382_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read range-restricted unsigned 16-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 200U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000383_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min value to a range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeRangeRestrictedInt16uWithValue:rangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min value to a range-restricted unsigned 16-bit integer Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000384_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-below-range value to a range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:99U]; - [cluster - writeAttributeRangeRestrictedInt16uWithValue:rangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"Write just-below-range value to a range-restricted unsigned 16-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000385_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-above-range value to a range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:1001U]; - [cluster - writeAttributeRangeRestrictedInt16uWithValue:rangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"Write just-above-range value to a range-restricted unsigned 16-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000386_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max value to a range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:65535U]; - [cluster writeAttributeRangeRestrictedInt16uWithValue:rangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max value to a range-restricted unsigned 16-bit integer Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000387_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted unsigned 16-bit integer value has not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted unsigned 16-bit integer value has not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 200U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000388_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min valid value to a range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:100U]; - [cluster - writeAttributeRangeRestrictedInt16uWithValue:rangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min valid value to a range-restricted unsigned 16-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000389_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted unsigned 16-bit integer value is at min valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted unsigned 16-bit integer value is at min valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 100U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000390_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max valid value to a range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:1000U]; - [cluster - writeAttributeRangeRestrictedInt16uWithValue:rangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max valid value to a range-restricted unsigned 16-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000391_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted unsigned 16-bit integer value is at max valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted unsigned 16-bit integer value is at max valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 1000U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000392_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write middle valid value to a range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:500U]; - [cluster - writeAttributeRangeRestrictedInt16uWithValue:rangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write middle valid value to a range-restricted unsigned 16-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000393_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted unsigned 16-bit integer value is at mid valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted unsigned 16-bit integer value is at mid valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 500U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000394_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read range-restricted signed 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], -20); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000395_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min value to a range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = [NSNumber numberWithChar:-128]; - [cluster writeAttributeRangeRestrictedInt8sWithValue:rangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min value to a range-restricted signed 8-bit integer Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000396_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-below-range value to a range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = [NSNumber numberWithChar:-41]; - [cluster - writeAttributeRangeRestrictedInt8sWithValue:rangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-below-range value to a range-restricted signed 8-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000397_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-above-range value to a range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = [NSNumber numberWithChar:51]; - [cluster - writeAttributeRangeRestrictedInt8sWithValue:rangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-above-range value to a range-restricted signed 8-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000398_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max value to a range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = [NSNumber numberWithChar:127]; - [cluster writeAttributeRangeRestrictedInt8sWithValue:rangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max value to a range-restricted signed 8-bit integer Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000399_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted signed 8-bit integer value has not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted signed 8-bit integer value has not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], -20); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000400_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min valid value to a range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = [NSNumber numberWithChar:-40]; - [cluster - writeAttributeRangeRestrictedInt8sWithValue:rangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min valid value to a range-restricted signed 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000401_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted signed 8-bit integer value is at min valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted signed 8-bit integer value is at min valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], -40); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000402_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max valid value to a range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = [NSNumber numberWithChar:50]; - [cluster - writeAttributeRangeRestrictedInt8sWithValue:rangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max valid value to a range-restricted signed 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000403_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted signed 8-bit integer value is at max valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted signed 8-bit integer value is at max valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], 50); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000404_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write middle valid value to a range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = [NSNumber numberWithChar:6]; - [cluster - writeAttributeRangeRestrictedInt8sWithValue:rangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write middle valid value to a range-restricted signed 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000405_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted signed 8-bit integer value is at mid valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted signed 8-bit integer value is at mid valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], 6); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000406_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read range-restricted signed 16-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], -100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000407_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min value to a range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = [NSNumber numberWithShort:-32768]; - [cluster writeAttributeRangeRestrictedInt16sWithValue:rangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min value to a range-restricted signed 16-bit integer Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000408_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-below-range value to a range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = [NSNumber numberWithShort:-151]; - [cluster - writeAttributeRangeRestrictedInt16sWithValue:rangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-below-range value to a range-restricted signed 16-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000409_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-above-range value to a range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = [NSNumber numberWithShort:201]; - [cluster - writeAttributeRangeRestrictedInt16sWithValue:rangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-above-range value to a range-restricted signed 16-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000410_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max value to a range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = [NSNumber numberWithShort:32767]; - [cluster writeAttributeRangeRestrictedInt16sWithValue:rangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max value to a range-restricted signed 16-bit integer Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000411_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted signed 16-bit integer value has not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted signed 16-bit integer value has not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], -100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000412_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min valid value to a range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = [NSNumber numberWithShort:-150]; - [cluster - writeAttributeRangeRestrictedInt16sWithValue:rangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min valid value to a range-restricted signed 16-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000413_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted signed 16-bit integer value is at min valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted signed 16-bit integer value is at min valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], -150); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000414_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max valid value to a range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = [NSNumber numberWithShort:200]; - [cluster - writeAttributeRangeRestrictedInt16sWithValue:rangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max valid value to a range-restricted signed 16-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000415_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted signed 16-bit integer value is at max valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted signed 16-bit integer value is at max valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 200); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000416_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write middle valid value to a range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = [NSNumber numberWithShort:7]; - [cluster writeAttributeRangeRestrictedInt16sWithValue:rangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write middle valid value to a range-restricted signed 16-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000417_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify range-restricted signed 16-bit integer value is at mid valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify range-restricted signed 16-bit integer value is at mid valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 7); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000418_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read nullable range-restricted unsigned 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 70); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000419_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min value to a nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:nullableRangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min value to a nullable range-restricted unsigned 8-bit integer " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000420_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-below-range value to a nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:19]; - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:nullableRangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-below-range value to a nullable range-restricted unsigned " - @"8-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000421_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-above-range value to a nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:101]; - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:nullableRangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-above-range value to a nullable range-restricted unsigned " - @"8-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000422_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max value to a nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:nullableRangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max value to a nullable range-restricted unsigned 8-bit integer " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000423_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 8-bit integer value has not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 8-bit integer value has not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 70); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000424_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min valid value to a nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:20]; - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:nullableRangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min valid value to a nullable range-restricted unsigned 8-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000425_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 8-bit integer value is at min valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 8-bit integer value is at min valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 20); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000426_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max valid value to a nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:100]; - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:nullableRangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max valid value to a nullable range-restricted unsigned 8-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000427_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 8-bit integer value is at max valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 8-bit integer value is at max valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000428_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write middle valid value to a nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument = [NSNumber numberWithUnsignedChar:50]; - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:nullableRangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write middle valid value to a nullable range-restricted unsigned 8-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000429_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 8-bit integer value is at mid valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 8-bit integer value is at mid valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 50); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000430_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write null value to a nullable range-restricted unsigned 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument = nil; - [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:nullableRangeRestrictedInt8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write null value to a nullable range-restricted unsigned 8-bit integer " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000431_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 8-bit integer value is null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 8-bit integer value is null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000432_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read nullable range-restricted unsigned 16-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 200U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000433_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min value to a nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:nullableRangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min value to a nullable range-restricted unsigned 16-bit integer " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000434_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-below-range value to a nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:99U]; - [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:nullableRangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-below-range value to a nullable range-restricted unsigned " - @"16-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000435_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-above-range value to a nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:1001U]; - [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:nullableRangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-above-range value to a nullable range-restricted unsigned " - @"16-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000436_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max value to a nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:65534U]; - [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:nullableRangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max value to a nullable range-restricted unsigned 16-bit integer " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000437_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 16-bit integer value has not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 16-bit integer value has not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 200U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000438_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min valid value to a nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:100U]; - [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:nullableRangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min valid value to a nullable range-restricted unsigned 16-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000439_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 16-bit integer value is at min valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 16-bit integer value is at min valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 100U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000440_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max valid value to a nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:1000U]; - [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:nullableRangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max valid value to a nullable range-restricted unsigned 16-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000441_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 16-bit integer value is at max valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 16-bit integer value is at max valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 1000U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000442_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write middle valid value to a nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument = [NSNumber numberWithUnsignedShort:500U]; - [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:nullableRangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write middle valid value to a nullable range-restricted unsigned " - @"16-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000443_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 16-bit integer value is at mid valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 16-bit integer value is at mid valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 500U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000444_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write null value to a nullable range-restricted unsigned 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument = nil; - [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:nullableRangeRestrictedInt16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write null value to a nullable range-restricted unsigned 16-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000445_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted unsigned 16-bit integer value is null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted unsigned 16-bit integer value is null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000446_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read nullable range-restricted signed 8-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue charValue], -20); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000447_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min value to a nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument = [NSNumber numberWithChar:-127]; - [cluster - writeAttributeNullableRangeRestrictedInt8sWithValue:nullableRangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"Write min value to a nullable range-restricted signed 8-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000448_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-below-range value to a nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument = [NSNumber numberWithChar:-41]; - [cluster writeAttributeNullableRangeRestrictedInt8sWithValue:nullableRangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-below-range value to a nullable range-restricted signed " - @"8-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000449_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-above-range value to a nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument = [NSNumber numberWithChar:51]; - [cluster writeAttributeNullableRangeRestrictedInt8sWithValue:nullableRangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-above-range value to a nullable range-restricted signed " - @"8-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000450_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max value to a nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument = [NSNumber numberWithChar:127]; - [cluster - writeAttributeNullableRangeRestrictedInt8sWithValue:nullableRangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"Write max value to a nullable range-restricted signed 8-bit integer Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000451_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 8-bit integer value has not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 8-bit integer value has not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue charValue], -20); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000452_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min valid value to a nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument = [NSNumber numberWithChar:-40]; - [cluster writeAttributeNullableRangeRestrictedInt8sWithValue:nullableRangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min valid value to a nullable range-restricted signed 8-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000453_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 8-bit integer value is at min valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 8-bit integer value is at min valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue charValue], -40); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000454_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max valid value to a nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument = [NSNumber numberWithChar:50]; - [cluster writeAttributeNullableRangeRestrictedInt8sWithValue:nullableRangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max valid value to a nullable range-restricted signed 8-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000455_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 8-bit integer value is at max valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 8-bit integer value is at max valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue charValue], 50); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000456_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write middle valid value to a nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument = [NSNumber numberWithChar:6]; - [cluster writeAttributeNullableRangeRestrictedInt8sWithValue:nullableRangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write middle valid value to a nullable range-restricted signed 8-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000457_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 8-bit integer value is at mid valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 8-bit integer value is at mid valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue charValue], 6); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000458_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write null value to a nullable range-restricted signed 8-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument = nil; - [cluster - writeAttributeNullableRangeRestrictedInt8sWithValue:nullableRangeRestrictedInt8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"Write null value to a nullable range-restricted signed 8-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000459_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 8-bit integer value is at null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeNullableRangeRestrictedInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 8-bit integer value is at null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000460_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read nullable range-restricted signed 16-bit integer Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], -100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000461_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min value to a nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument = [NSNumber numberWithShort:-32767]; - [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:nullableRangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min value to a nullable range-restricted signed 16-bit integer " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000462_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-below-range value to a nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument = [NSNumber numberWithShort:-151]; - [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:nullableRangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-below-range value to a nullable range-restricted signed " - @"16-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000463_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write just-above-range value to a nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument = [NSNumber numberWithShort:201]; - [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:nullableRangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write just-above-range value to a nullable range-restricted signed " - @"16-bit integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000464_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max value to a nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument = [NSNumber numberWithShort:32767]; - [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:nullableRangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max value to a nullable range-restricted signed 16-bit integer " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000465_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 16-bit integer value has not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 16-bit integer value has not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], -100); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000466_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write min valid value to a nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument = [NSNumber numberWithShort:-150]; - [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:nullableRangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write min valid value to a nullable range-restricted signed 16-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000467_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 16-bit integer value is at min valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 16-bit integer value is at min valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], -150); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000468_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write max valid value to a nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument = [NSNumber numberWithShort:200]; - [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:nullableRangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write max valid value to a nullable range-restricted signed 16-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000469_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 16-bit integer value is at max valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 16-bit integer value is at max valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], 200); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000470_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write middle valid value to a nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument = [NSNumber numberWithShort:7]; - [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:nullableRangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write middle valid value to a nullable range-restricted signed 16-bit " - @"integer Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000471_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 16-bit integer value is at mid valid"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 16-bit integer value is at mid valid Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue shortValue], 7); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000472_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write null value to a nullable range-restricted signed 16-bit integer"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument = nil; - [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:nullableRangeRestrictedInt16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write null value to a nullable range-restricted signed 16-bit integer " - @"Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000473_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Verify nullable range-restricted signed 16-bit integer value is null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster - readAttributeNullableRangeRestrictedInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify nullable range-restricted signed 16-bit integer value is null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000474_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute that returns general status on write"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id generalErrorBooleanArgument; - generalErrorBooleanArgument = [NSNumber numberWithBool:false]; - [cluster writeAttributeGeneralErrorBooleanWithValue:generalErrorBooleanArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute that returns general status on write Error: %@", err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_INVALID_DATA_TYPE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000475_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write attribute that returns cluster-specific status on write"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id clusterErrorBooleanArgument; - clusterErrorBooleanArgument = [NSNumber numberWithBool:false]; - [cluster writeAttributeClusterErrorBooleanWithValue:clusterErrorBooleanArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute that returns cluster-specific status on write Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_FAILURE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000476_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute that returns general status on read"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeGeneralErrorBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute that returns general status on read Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_INVALID_DATA_TYPE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000477_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"read attribute that returns cluster-specific status on read"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterErrorBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read attribute that returns cluster-specific status on read Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_FAILURE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000478_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read AcceptedCommandList attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"read AcceptedCommandList attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 18); - XCTAssertEqual([actualValue[0] unsignedIntValue], 0UL); - XCTAssertEqual([actualValue[1] unsignedIntValue], 1UL); - XCTAssertEqual([actualValue[2] unsignedIntValue], 2UL); - XCTAssertEqual([actualValue[3] unsignedIntValue], 4UL); - XCTAssertEqual([actualValue[4] unsignedIntValue], 7UL); - XCTAssertEqual([actualValue[5] unsignedIntValue], 8UL); - XCTAssertEqual([actualValue[6] unsignedIntValue], 9UL); - XCTAssertEqual([actualValue[7] unsignedIntValue], 10UL); - XCTAssertEqual([actualValue[8] unsignedIntValue], 11UL); - XCTAssertEqual([actualValue[9] unsignedIntValue], 12UL); - XCTAssertEqual([actualValue[10] unsignedIntValue], 13UL); - XCTAssertEqual([actualValue[11] unsignedIntValue], 14UL); - XCTAssertEqual([actualValue[12] unsignedIntValue], 15UL); - XCTAssertEqual([actualValue[13] unsignedIntValue], 17UL); - XCTAssertEqual([actualValue[14] unsignedIntValue], 18UL); - XCTAssertEqual([actualValue[15] unsignedIntValue], 19UL); - XCTAssertEqual([actualValue[16] unsignedIntValue], 20UL); - XCTAssertEqual([actualValue[17] unsignedIntValue], 21UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000479_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read GeneratedCommandList attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"read GeneratedCommandList attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 8); - XCTAssertEqual([actualValue[0] unsignedIntValue], 0UL); - XCTAssertEqual([actualValue[1] unsignedIntValue], 1UL); - XCTAssertEqual([actualValue[2] unsignedIntValue], 4UL); - XCTAssertEqual([actualValue[3] unsignedIntValue], 5UL); - XCTAssertEqual([actualValue[4] unsignedIntValue], 6UL); - XCTAssertEqual([actualValue[5] unsignedIntValue], 9UL); - XCTAssertEqual([actualValue[6] unsignedIntValue], 10UL); - XCTAssertEqual([actualValue[7] unsignedIntValue], 11UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000480_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write struct-typed attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id structAttrArgument; - structAttrArgument = [[CHIPTestClusterClusterSimpleStruct alloc] init]; - ((CHIPTestClusterClusterSimpleStruct *) structAttrArgument).a = [NSNumber numberWithUnsignedChar:5]; - ((CHIPTestClusterClusterSimpleStruct *) structAttrArgument).b = [NSNumber numberWithBool:true]; - ((CHIPTestClusterClusterSimpleStruct *) structAttrArgument).c = [NSNumber numberWithUnsignedChar:2]; - ((CHIPTestClusterClusterSimpleStruct *) structAttrArgument).d = [[NSData alloc] initWithBytes:"abc" length:3]; - ((CHIPTestClusterClusterSimpleStruct *) structAttrArgument).e = @""; - ((CHIPTestClusterClusterSimpleStruct *) structAttrArgument).f = [NSNumber numberWithUnsignedChar:17]; - ((CHIPTestClusterClusterSimpleStruct *) structAttrArgument).g = [NSNumber numberWithFloat:1.5f]; - ((CHIPTestClusterClusterSimpleStruct *) structAttrArgument).h = [NSNumber numberWithDouble:3.14159265358979]; - - [cluster writeAttributeStructAttrWithValue:structAttrArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write struct-typed attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestCluster_000481_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read struct-typed attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStructAttrWithCompletionHandler:^( - CHIPTestClusterClusterSimpleStruct * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read struct-typed attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).a unsignedCharValue], 5); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).b boolValue], true); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).c unsignedCharValue], 2); - XCTAssertTrue([((CHIPTestClusterClusterSimpleStruct *) actualValue).d isEqualToData:[[NSData alloc] initWithBytes:"abc" - length:3]]); - XCTAssertTrue([((CHIPTestClusterClusterSimpleStruct *) actualValue).e isEqualToString:@""]); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).f unsignedCharValue], 17); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).g floatValue], 1.5f); - XCTAssertEqual([((CHIPTestClusterClusterSimpleStruct *) actualValue).h doubleValue], 3.14159265358979); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestSaveAs_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]; -} -NSNumber * _Nonnull TestAddArgumentDefaultValue; -- (void)testSendClusterTestSaveAs_000001_TestAddArguments -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Add Arguments Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestAddArgumentsParams alloc] init]; - params.arg1 = [NSNumber numberWithUnsignedChar:3]; - params.arg2 = [NSNumber numberWithUnsignedChar:17]; - [cluster testAddArgumentsWithParams:params - completionHandler:^( - CHIPTestClusterClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Add Arguments Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.returnValue; - XCTAssertEqual([actualValue unsignedCharValue], 20); - } - { - id actualValue = values.returnValue; - TestAddArgumentDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000002_TestAddArguments -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Add Arguments Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestAddArgumentsParams alloc] init]; - params.arg1 = [NSNumber numberWithUnsignedChar:3]; - params.arg2 = [NSNumber numberWithUnsignedChar:17]; - [cluster testAddArgumentsWithParams:params - completionHandler:^( - CHIPTestClusterClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Add Arguments Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.returnValue; - XCTAssertEqualObjects(actualValue, TestAddArgumentDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000003_TestAddArguments -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Add Arguments Command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPTestClusterClusterTestAddArgumentsParams alloc] init]; - params.arg1 = [NSNumber numberWithUnsignedChar:3]; - params.arg2 = [TestAddArgumentDefaultValue copy]; - [cluster testAddArgumentsWithParams:params - completionHandler:^( - CHIPTestClusterClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Send Test Add Arguments Command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.returnValue; - XCTAssertNotEqualObjects(actualValue, TestAddArgumentDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeBooleanDefaultValue; -- (void)testSendClusterTestSaveAs_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BOOLEAN Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); - } - { - id actualValue = value; - readAttributeBooleanDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000005_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BOOLEAN Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id booleanArgument; - booleanArgument = [NSNumber numberWithBool:1]; - [cluster writeAttributeBooleanWithValue:booleanArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BOOLEAN Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BOOLEAN Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeBooleanDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000007_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BOOLEAN DefaultValue"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id booleanArgument; - booleanArgument = [readAttributeBooleanDefaultValue copy]; - [cluster writeAttributeBooleanWithValue:booleanArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BOOLEAN DefaultValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN False"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BOOLEAN False Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeBooleanDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeBitmap8DefaultValue; -- (void)testSendClusterTestSaveAs_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP8 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = value; - readAttributeBitmap8DefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000010_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP8 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap8Argument; - bitmap8Argument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeBitmap8WithValue:bitmap8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP8 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP8 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeBitmap8DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000012_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP8 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap8Argument; - bitmap8Argument = [readAttributeBitmap8DefaultValue copy]; - [cluster writeAttributeBitmap8WithValue:bitmap8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP8 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000013_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP8 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeBitmap8DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeBitmap16DefaultValue; -- (void)testSendClusterTestSaveAs_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP16 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - { - id actualValue = value; - readAttributeBitmap16DefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000015_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP16 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap16Argument; - bitmap16Argument = [NSNumber numberWithUnsignedShort:1U]; - [cluster writeAttributeBitmap16WithValue:bitmap16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP16 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000016_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP16 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeBitmap16DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000017_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP16 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap16Argument; - bitmap16Argument = [readAttributeBitmap16DefaultValue copy]; - [cluster writeAttributeBitmap16WithValue:bitmap16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP16 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP16 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeBitmap16DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeBitmap32DefaultValue; -- (void)testSendClusterTestSaveAs_000019_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP32 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - { - id actualValue = value; - readAttributeBitmap32DefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000020_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP32 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap32Argument; - bitmap32Argument = [NSNumber numberWithUnsignedInt:1UL]; - [cluster writeAttributeBitmap32WithValue:bitmap32Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP32 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000021_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP32 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeBitmap32DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000022_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP32 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap32Argument; - bitmap32Argument = [readAttributeBitmap32DefaultValue copy]; - [cluster writeAttributeBitmap32WithValue:bitmap32Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP32 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000023_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap32WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP32 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeBitmap32DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeBitmap64DefaultValue; -- (void)testSendClusterTestSaveAs_000024_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP64 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - { - id actualValue = value; - readAttributeBitmap64DefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000025_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP64 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap64Argument; - bitmap64Argument = [NSNumber numberWithUnsignedLongLong:1ULL]; - [cluster writeAttributeBitmap64WithValue:bitmap64Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP64 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000026_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP64 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeBitmap64DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000027_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP64 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bitmap64Argument; - bitmap64Argument = [readAttributeBitmap64DefaultValue copy]; - [cluster writeAttributeBitmap64WithValue:bitmap64Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute BITMAP64 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000028_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap64WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute BITMAP64 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeBitmap64DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeInt8uDefaultValue; -- (void)testSendClusterTestSaveAs_000029_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = value; - readAttributeInt8uDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000030_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8U Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8uArgument; - int8uArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeInt8uWithValue:int8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8U Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000031_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8U Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeInt8uDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000032_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8uArgument; - int8uArgument = [readAttributeInt8uDefaultValue copy]; - [cluster writeAttributeInt8uWithValue:int8uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000033_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeInt8uDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeInt16uDefaultValue; -- (void)testSendClusterTestSaveAs_000034_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - { - id actualValue = value; - readAttributeInt16uDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000035_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16U Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16uArgument; - int16uArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster writeAttributeInt16uWithValue:int16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16U Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000036_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16U Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeInt16uDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000037_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16uArgument; - int16uArgument = [readAttributeInt16uDefaultValue copy]; - [cluster writeAttributeInt16uWithValue:int16uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000038_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeInt16uDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeInt32uDefaultValue; -- (void)testSendClusterTestSaveAs_000039_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - { - id actualValue = value; - readAttributeInt32uDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000040_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32uArgument; - int32uArgument = [NSNumber numberWithUnsignedInt:1UL]; - [cluster writeAttributeInt32uWithValue:int32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32U Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000041_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeInt32uDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000042_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32uArgument; - int32uArgument = [readAttributeInt32uDefaultValue copy]; - [cluster writeAttributeInt32uWithValue:int32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000043_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeInt32uDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeInt64uDefaultValue; -- (void)testSendClusterTestSaveAs_000044_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - { - id actualValue = value; - readAttributeInt64uDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000045_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64U Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64uArgument; - int64uArgument = [NSNumber numberWithUnsignedLongLong:1ULL]; - [cluster writeAttributeInt64uWithValue:int64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT64U Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000046_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64U Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeInt64uDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000047_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64uArgument; - int64uArgument = [readAttributeInt64uDefaultValue copy]; - [cluster writeAttributeInt64uWithValue:int64uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT64U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000048_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64U Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeInt64uDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeInt8sDefaultValue; -- (void)testSendClusterTestSaveAs_000049_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue charValue], 0); - } - { - id actualValue = value; - readAttributeInt8sDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000050_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8sArgument; - int8sArgument = [NSNumber numberWithChar:1]; - [cluster writeAttributeInt8sWithValue:int8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000051_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeInt8sDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000052_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int8sArgument; - int8sArgument = [readAttributeInt8sDefaultValue copy]; - [cluster writeAttributeInt8sWithValue:int8sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT8S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000053_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT8S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeInt8sDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeInt16sDefaultValue; -- (void)testSendClusterTestSaveAs_000054_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 0); - } - { - id actualValue = value; - readAttributeInt16sDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000055_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16sArgument; - int16sArgument = [NSNumber numberWithShort:1]; - [cluster writeAttributeInt16sWithValue:int16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000056_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeInt16sDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000057_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int16sArgument; - int16sArgument = [readAttributeInt16sDefaultValue copy]; - [cluster writeAttributeInt16sWithValue:int16sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT16S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000058_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT16S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeInt16sDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeInt32sDefaultValue; -- (void)testSendClusterTestSaveAs_000059_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue intValue], 0L); - } - { - id actualValue = value; - readAttributeInt32sDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000060_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32sArgument; - int32sArgument = [NSNumber numberWithInt:1L]; - [cluster writeAttributeInt32sWithValue:int32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000061_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeInt32sDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000062_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32sArgument; - int32sArgument = [readAttributeInt32sDefaultValue copy]; - [cluster writeAttributeInt32sWithValue:int32sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000063_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeInt32sDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeInt64sDefaultValue; -- (void)testSendClusterTestSaveAs_000064_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue longLongValue], 0LL); - } - { - id actualValue = value; - readAttributeInt64sDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000065_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INTS Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64sArgument; - int64sArgument = [NSNumber numberWithLongLong:1LL]; - [cluster writeAttributeInt64sWithValue:int64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INTS Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000066_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeInt64sDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000067_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int64sArgument; - int64sArgument = [readAttributeInt64sDefaultValue copy]; - [cluster writeAttributeInt64sWithValue:int64sArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT64S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000068_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64sWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT64S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeInt64sDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeEnum8DefaultValue; -- (void)testSendClusterTestSaveAs_000069_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM8 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = value; - readAttributeEnum8DefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000070_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM8 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enum8Argument; - enum8Argument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeEnum8WithValue:enum8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute ENUM8 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000071_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM8 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeEnum8DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000072_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM8 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enum8Argument; - enum8Argument = [readAttributeEnum8DefaultValue copy]; - [cluster writeAttributeEnum8WithValue:enum8Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute ENUM8 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000073_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum8WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM8 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeEnum8DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeEnum16DefaultValue; -- (void)testSendClusterTestSaveAs_000074_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM16 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - { - id actualValue = value; - readAttributeEnum16DefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000075_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM16 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enum16Argument; - enum16Argument = [NSNumber numberWithUnsignedShort:1U]; - [cluster writeAttributeEnum16WithValue:enum16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute ENUM16 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000076_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM16 Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeEnum16DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000077_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM16 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id enum16Argument; - enum16Argument = [readAttributeEnum16DefaultValue copy]; - [cluster writeAttributeEnum16WithValue:enum16Argument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute ENUM16 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000078_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum16WithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute ENUM16 Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeEnum16DefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeEpochUSDefaultValue; -- (void)testSendClusterTestSaveAs_000079_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_US Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochUsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_US Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - { - id actualValue = value; - readAttributeEpochUSDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000080_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute EPOCH_US Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id epochUsArgument; - epochUsArgument = [NSNumber numberWithUnsignedLongLong:1ULL]; - [cluster writeAttributeEpochUsWithValue:epochUsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute EPOCH_US Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000081_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_US Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochUsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_US Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeEpochUSDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000082_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute EPOCH_US Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id epochUsArgument; - epochUsArgument = [readAttributeEpochUSDefaultValue copy]; - [cluster writeAttributeEpochUsWithValue:epochUsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute EPOCH_US Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000083_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_US Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochUsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_US Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeEpochUSDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeEpochSDefaultValue; -- (void)testSendClusterTestSaveAs_000084_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochSWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); - } - { - id actualValue = value; - readAttributeEpochSDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000085_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute EPOCH_S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id epochSArgument; - epochSArgument = [NSNumber numberWithUnsignedInt:1UL]; - [cluster writeAttributeEpochSWithValue:epochSArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute EPOCH_S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000086_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_S Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochSWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_S Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeEpochSDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000087_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute EPOCH_S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id epochSArgument; - epochSArgument = [readAttributeEpochSDefaultValue copy]; - [cluster writeAttributeEpochSWithValue:epochSArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute EPOCH_S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000088_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_S Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEpochSWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute EPOCH_S Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeEpochSDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull readAttributeVendorIdDefaultValue; -- (void)testSendClusterTestSaveAs_000089_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute vendor_id Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute vendor_id Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - { - id actualValue = value; - readAttributeVendorIdDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000090_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute vendor_id Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id vendorIdArgument; - vendorIdArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster writeAttributeVendorIdWithValue:vendorIdArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute vendor_id Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000091_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute vendor_id Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute vendor_id Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeVendorIdDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000092_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute vendor_id Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id vendorIdArgument; - vendorIdArgument = [readAttributeVendorIdDefaultValue copy]; - [cluster writeAttributeVendorIdWithValue:vendorIdArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute vendor_id Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000093_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute vendor_id Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeVendorIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute vendor_id Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeVendorIdDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSString * _Nonnull readAttributeCharStringDefaultValue; -- (void)testSendClusterTestSaveAs_000094_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute char_string Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute char_string Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@""]); - } - { - id actualValue = value; - readAttributeCharStringDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000095_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute char_string Default Value and compare to saved value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute char_string Default Value and compare to saved value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeCharStringDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000096_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute char_string Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"NotDefault"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute char_string Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSString * _Nonnull readAttributeCharStringNotDefaultValue; -- (void)testSendClusterTestSaveAs_000097_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute char_string Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute char_string Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@"NotDefault"]); - } - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeCharStringDefaultValue); - } - { - id actualValue = value; - readAttributeCharStringNotDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000098_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute char_string Not Default Value and compare to saved value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute char_string Not Default Value and compare to saved value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeCharStringNotDefaultValue); - } - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeCharStringDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000099_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write attribute char_string Not Default Value from saved value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = [readAttributeCharStringNotDefaultValue copy]; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute char_string Not Default Value from saved value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000100_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute char_string Not Default Value and compare to expected value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute char_string Not Default Value and compare to expected value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@"NotDefault"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000101_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute char_string Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = [readAttributeCharStringDefaultValue copy]; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute char_string Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSData * _Nonnull readAttributeOctetStringDefaultValue; -- (void)testSendClusterTestSaveAs_000102_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute octet_string Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute octet_string Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"" length:0]]); - } - { - id actualValue = value; - readAttributeOctetStringDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000103_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute octet_string Default Value and compare to saved value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute octet_string Default Value and compare to saved value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeOctetStringDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000104_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute octet_string Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id octetStringArgument; - octetStringArgument = [[NSData alloc] initWithBytes:"NotDefault" length:10]; - [cluster writeAttributeOctetStringWithValue:octetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute octet_string Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSData * _Nonnull readAttributeOctetStringNotDefaultValue; -- (void)testSendClusterTestSaveAs_000105_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute octet_string Not Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute octet_string Not Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"NotDefault" length:10]]); - } - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeOctetStringDefaultValue); - } - { - id actualValue = value; - readAttributeOctetStringNotDefaultValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000106_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute octet_string Not Default Value and compare to saved value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute octet_string Not Default Value and compare to saved value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, readAttributeOctetStringNotDefaultValue); - } - { - id actualValue = value; - XCTAssertNotEqualObjects(actualValue, readAttributeOctetStringDefaultValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000107_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write attribute octet_string Not Default Value from saved value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id octetStringArgument; - octetStringArgument = [readAttributeOctetStringNotDefaultValue copy]; - [cluster writeAttributeOctetStringWithValue:octetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute octet_string Not Default Value from saved value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000108_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute octet_string Not Default Value and compare to expected value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithCompletionHandler:^(NSData * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute octet_string Not Default Value and compare to expected value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToData:[[NSData alloc] initWithBytes:"NotDefault" length:10]]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSaveAs_000109_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute octet_string Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id octetStringArgument; - octetStringArgument = [readAttributeOctetStringDefaultValue copy]; - [cluster writeAttributeOctetStringWithValue:octetStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute octet_string Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestConstraints_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)testSendClusterTestConstraints_000001_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32uArgument; - int32uArgument = [NSNumber numberWithUnsignedInt:5UL]; - [cluster writeAttributeInt32uWithValue:int32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32U Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Value MinValue Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Value MinValue Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedIntValue], 5UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Value MaxValue Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Value MaxValue Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedIntValue], 5UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Value NotValue Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute INT32U Value NotValue Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedIntValue], 6UL); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000005_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Value Back to Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id int32uArgument; - int32uArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeInt32uWithValue:int32uArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute INT32U Value Back to Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000006_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"** Test **"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING Value MinLength Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value MinLength Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertGreaterThanOrEqual([actualValue length], 5); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING Value MaxLength Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value MaxLength Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertLessThanOrEqual([actualValue length], 20); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000009_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING Value StartsWith Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value StartsWith Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue hasPrefix:@"**"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING Value EndsWith Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value EndsWith Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue hasSuffix:@"**"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000011_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"lowercase"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000012_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - BOOL isLowerCase = [actualValue isEqualToString:[actualValue lowercaseString]]; - XCTAssertTrue(isLowerCase); - } - { - id actualValue = value; - BOOL isUpperCase = [actualValue isEqualToString:[actualValue uppercaseString]]; - XCTAssertFalse(isUpperCase); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000013_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"UPPERCASE"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000014_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - BOOL isLowerCase = [actualValue isEqualToString:[actualValue lowercaseString]]; - XCTAssertFalse(isLowerCase); - } - { - id actualValue = value; - BOOL isUpperCase = [actualValue isEqualToString:[actualValue uppercaseString]]; - XCTAssertTrue(isUpperCase); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000015_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"lowUPPER"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000016_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - BOOL isLowerCase = [actualValue isEqualToString:[actualValue lowercaseString]]; - XCTAssertFalse(isLowerCase); - } - { - id actualValue = value; - BOOL isUpperCase = [actualValue isEqualToString:[actualValue uppercaseString]]; - XCTAssertFalse(isUpperCase); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000017_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"ABCDEF012V"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000018_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING Value isHexString Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value isHexString Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - NSCharacterSet * chars = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789ABCDEF"] invertedSet]; - BOOL isHexString = (NSNotFound == [actualValue rangeOfCharacterFromSet:chars].location); - XCTAssertFalse(isHexString); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000019_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @"ABCDEF0123"; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000020_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING Value isHexString Constraints"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCharStringWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute CHAR_STRING Value isHexString Constraints Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - NSCharacterSet * chars = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789ABCDEF"] invertedSet]; - BOOL isHexString = (NSNotFound == [actualValue rangeOfCharacterFromSet:chars].location); - XCTAssertTrue(isHexString); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestConstraints_000021_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING Value Back to Default Value"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id charStringArgument; - charStringArgument = @""; - [cluster writeAttributeCharStringWithValue:charStringArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write attribute CHAR_STRING Value Back to Default Value Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestDelayCommands_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)testSendClusterTestDelayCommands_000001_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestDescriptorCluster_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)testSendClusterTestDescriptorCluster_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute Device list"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDescriptor * cluster = [[CHIPTestDescriptor alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDeviceListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute Device list Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual([((CHIPDescriptorClusterDeviceType *) actualValue[0]).type unsignedIntValue], 22UL); - XCTAssertEqual([((CHIPDescriptorClusterDeviceType *) actualValue[0]).revision unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestDescriptorCluster_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute Server list"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDescriptor * cluster = [[CHIPTestDescriptor alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeServerListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute Server list Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 25); - XCTAssertEqual([actualValue[0] unsignedIntValue], 3UL); - XCTAssertEqual([actualValue[1] unsignedIntValue], 4UL); - XCTAssertEqual([actualValue[2] unsignedIntValue], 29UL); - XCTAssertEqual([actualValue[3] unsignedIntValue], 30UL); - XCTAssertEqual([actualValue[4] unsignedIntValue], 31UL); - XCTAssertEqual([actualValue[5] unsignedIntValue], 40UL); - XCTAssertEqual([actualValue[6] unsignedIntValue], 42UL); - XCTAssertEqual([actualValue[7] unsignedIntValue], 43UL); - XCTAssertEqual([actualValue[8] unsignedIntValue], 44UL); - XCTAssertEqual([actualValue[9] unsignedIntValue], 45UL); - XCTAssertEqual([actualValue[10] unsignedIntValue], 46UL); - XCTAssertEqual([actualValue[11] unsignedIntValue], 48UL); - XCTAssertEqual([actualValue[12] unsignedIntValue], 49UL); - XCTAssertEqual([actualValue[13] unsignedIntValue], 50UL); - XCTAssertEqual([actualValue[14] unsignedIntValue], 51UL); - XCTAssertEqual([actualValue[15] unsignedIntValue], 52UL); - XCTAssertEqual([actualValue[16] unsignedIntValue], 53UL); - XCTAssertEqual([actualValue[17] unsignedIntValue], 54UL); - XCTAssertEqual([actualValue[18] unsignedIntValue], 55UL); - XCTAssertEqual([actualValue[19] unsignedIntValue], 60UL); - XCTAssertEqual([actualValue[20] unsignedIntValue], 62UL); - XCTAssertEqual([actualValue[21] unsignedIntValue], 63UL); - XCTAssertEqual([actualValue[22] unsignedIntValue], 64UL); - XCTAssertEqual([actualValue[23] unsignedIntValue], 65UL); - XCTAssertEqual([actualValue[24] unsignedIntValue], 1029UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestDescriptorCluster_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute Client list"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDescriptor * cluster = [[CHIPTestDescriptor alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClientListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute Client list Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual([actualValue[0] unsignedIntValue], 41UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestDescriptorCluster_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute Parts list"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestDescriptor * cluster = [[CHIPTestDescriptor alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributePartsListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute Parts list Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 2); - XCTAssertEqual([actualValue[0] unsignedShortValue], 1U); - XCTAssertEqual([actualValue[1] unsignedShortValue], 2U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestGroupsCluster_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)testSendClusterTestGroupsCluster_000001_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 0 (invalid)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:0U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 0 (invalid) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 135); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000002_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 1 (not found)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 1 (not found) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 139); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000003_AddGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Add Group 1 (new)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterAddGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; - params.groupName = @"Group #1"; - [cluster addGroupWithParams:params - completionHandler:^(CHIPGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Add Group 1 (new) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000004_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 1 (new)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 1 (new) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - { - id actualValue = values.groupName; - XCTAssertTrue([actualValue isEqualToString:@"Group #1"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000005_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 2 (not found)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:4369U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 2 (not found) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 139); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 4369U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000006_GetGroupMembership -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Get Group Membership 1 (all)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterGetGroupMembershipParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - params.groupList = temp_0; - } - [cluster getGroupMembershipWithParams:params - completionHandler:^( - CHIPGroupsClusterGetGroupMembershipResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Get Group Membership 1 (all) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.capacity; - XCTAssertTrue(actualValue == nil); - } - { - id actualValue = values.groupList; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual([actualValue[0] unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000007_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 3 (not found)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:32767U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 3 (not found) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 139); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 32767U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000008_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 1 (existing)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 1 (existing) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - { - id actualValue = values.groupName; - XCTAssertTrue([actualValue isEqualToString:@"Group #1"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000009_RemoveGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Remove Group 0 (invalid)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterRemoveGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:0U]; - [cluster removeGroupWithParams:params - completionHandler:^(CHIPGroupsClusterRemoveGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Remove Group 0 (invalid) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 135); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000010_RemoveGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Remove Group 4 (not found)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterRemoveGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:4U]; - [cluster removeGroupWithParams:params - completionHandler:^(CHIPGroupsClusterRemoveGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Remove Group 4 (not found) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 139); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 4U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000011_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 1 (not removed)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 1 (not removed) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - { - id actualValue = values.groupName; - XCTAssertTrue([actualValue isEqualToString:@"Group #1"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000012_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 2 (removed)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:4369U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 2 (removed) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 139); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 4369U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000013_GetGroupMembership -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Get Group Membership 3"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterGetGroupMembershipParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [NSNumber numberWithUnsignedShort:1U]; - temp_0[1] = [NSNumber numberWithUnsignedShort:2U]; - temp_0[2] = [NSNumber numberWithUnsignedShort:4369U]; - temp_0[3] = [NSNumber numberWithUnsignedShort:3U]; - params.groupList = temp_0; - } - [cluster getGroupMembershipWithParams:params - completionHandler:^( - CHIPGroupsClusterGetGroupMembershipResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Get Group Membership 3 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.capacity; - XCTAssertTrue(actualValue == nil); - } - { - id actualValue = values.groupList; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual([actualValue[0] unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000014_RemoveAllGroups -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Remove All"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster removeAllGroupsWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Remove All Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000015_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 1 (removed)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 1 (removed) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 139); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000016_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 2 (still removed)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:4369U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 2 (still removed) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 139); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 4369U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000017_ViewGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"View Group 3 (removed)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:32767U]; - [cluster viewGroupWithParams:params - completionHandler:^(CHIPGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"View Group 3 (removed) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 139); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 32767U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupsCluster_000018_GetGroupMembership -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Get Group Membership 4"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterGetGroupMembershipParams alloc] init]; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [NSNumber numberWithUnsignedShort:1U]; - temp_0[1] = [NSNumber numberWithUnsignedShort:2U]; - temp_0[2] = [NSNumber numberWithUnsignedShort:4369U]; - temp_0[3] = [NSNumber numberWithUnsignedShort:3U]; - temp_0[4] = [NSNumber numberWithUnsignedShort:32767U]; - params.groupList = temp_0; - } - [cluster getGroupMembershipWithParams:params - completionHandler:^( - CHIPGroupsClusterGetGroupMembershipResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Get Group Membership 4 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.capacity; - XCTAssertTrue(actualValue == nil); - } - { - id actualValue = values.groupList; - XCTAssertEqual([actualValue count], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestGroupKeyManagementCluster_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)testSendClusterTestGroupKeyManagementCluster_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read maxGroupsPerFabric"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxGroupsPerFabricWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read maxGroupsPerFabric Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 2U); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read maxGroupKeysPerFabric"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxGroupKeysPerFabricWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read maxGroupKeysPerFabric Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 2U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000003_AddGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Add Group 1"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterAddGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:257U]; - params.groupName = @"Group #1"; - [cluster addGroupWithParams:params - completionHandler:^(CHIPGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Add Group 1 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 257U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000004_AddGroup -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Add Group 2"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupsClusterAddGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:258U]; - params.groupName = @"Group #2"; - [cluster addGroupWithParams:params - completionHandler:^(CHIPGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Add Group 2 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.status; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = values.groupId; - XCTAssertEqual([actualValue unsignedShortValue], 258U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000005_KeySetWrite -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"KeySet Write 1"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupKeyManagementClusterKeySetWriteParams alloc] init]; - params.groupKeySet = [[CHIPGroupKeyManagementClusterGroupKeySetStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = - [NSNumber numberWithUnsignedChar:0]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = - [[NSData alloc] initWithBytes:"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257" length:16]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = - [NSNumber numberWithUnsignedLongLong:1110000ULL]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = - [[NSData alloc] initWithBytes:"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" length:16]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = - [NSNumber numberWithUnsignedLongLong:1110001ULL]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = - [[NSData alloc] initWithBytes:"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" length:16]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = - [NSNumber numberWithUnsignedLongLong:1110002ULL]; - - [cluster keySetWriteWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"KeySet Write 1 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000006_KeySetWrite -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"KeySet Write 2"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupKeyManagementClusterKeySetWriteParams alloc] init]; - params.groupKeySet = [[CHIPGroupKeyManagementClusterGroupKeySetStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySetID = [NSNumber numberWithUnsignedShort:418U]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = - [NSNumber numberWithUnsignedChar:1]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = - [[NSData alloc] initWithBytes:"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337" length:16]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = - [NSNumber numberWithUnsignedLongLong:2110000ULL]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = - [[NSData alloc] initWithBytes:"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357" length:16]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = - [NSNumber numberWithUnsignedLongLong:2110001ULL]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = - [[NSData alloc] initWithBytes:"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" length:16]; - ((CHIPGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = - [NSNumber numberWithUnsignedLongLong:2110002ULL]; - - [cluster keySetWriteWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"KeySet Write 2 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000007_KeySetRead -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"KeySet Read"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupKeyManagementClusterKeySetReadParams alloc] init]; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; - [cluster - keySetReadWithParams:params - completionHandler:^(CHIPGroupKeyManagementClusterKeySetReadResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"KeySet Read Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.groupKeySet; - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).groupKeySetID unsignedShortValue], 417U); - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).groupKeySecurityPolicy unsignedCharValue], - 0); - XCTAssertTrue(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey0 == nil); - XCTAssertFalse(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime0 == nil); - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime0 unsignedLongLongValue], - 1110000ULL); - XCTAssertTrue(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey1 == nil); - XCTAssertFalse(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime1 == nil); - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime1 unsignedLongLongValue], - 1110001ULL); - XCTAssertTrue(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey2 == nil); - XCTAssertFalse(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime2 == nil); - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime2 unsignedLongLongValue], - 1110002ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000008_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write Group Keys (invalid)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id groupKeyMapArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupId = [NSNumber numberWithUnsignedShort:258U]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupKeySetID = [NSNumber numberWithUnsignedShort:0U]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; - - groupKeyMapArgument = temp_0; - } - [cluster writeAttributeGroupKeyMapWithValue:groupKeyMapArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write Group Keys (invalid) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000009_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write Group Keys"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id groupKeyMapArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupId = [NSNumber numberWithUnsignedShort:257U]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; - - temp_0[1] = [[CHIPGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).groupId = [NSNumber numberWithUnsignedShort:258U]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).groupKeySetID = [NSNumber numberWithUnsignedShort:418U]; - ((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:1]; - - groupKeyMapArgument = temp_0; - } - [cluster writeAttributeGroupKeyMapWithValue:groupKeyMapArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write Group Keys Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read Group Keys"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster readAttributeGroupKeyMapWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read Group Keys Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 2); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) - actualValue[0]).groupId unsignedShortValue], - 257U); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) - actualValue[0]).groupKeySetID unsignedShortValue], - 417U); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) - actualValue[0]).fabricIndex unsignedCharValue], - 1); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) - actualValue[1]).groupId unsignedShortValue], - 258U); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) - actualValue[1]).groupKeySetID unsignedShortValue], - 418U); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupKeyMapStruct *) - actualValue[1]).fabricIndex unsignedCharValue], - 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000011_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read GroupTable"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster readAttributeGroupTableWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read GroupTable Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 2); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) - actualValue[0]).groupId unsignedShortValue], - 257U); - XCTAssertTrue([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[0]).groupName - isEqualToString:@"Group #1"]); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) - actualValue[0]).fabricIndex unsignedCharValue], - 1); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) - actualValue[1]).groupId unsignedShortValue], - 258U); - XCTAssertTrue([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).groupName - isEqualToString:@"Group #2"]); - XCTAssertEqual([((CHIPGroupKeyManagementClusterGroupInfoMapStruct *) - actualValue[1]).fabricIndex unsignedCharValue], - 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000012_KeySetRemove -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"KeySet Remove 1"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupKeyManagementClusterKeySetRemoveParams alloc] init]; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; - [cluster keySetRemoveWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"KeySet Remove 1 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000013_KeySetRead -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"KeySet Read (removed)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupKeyManagementClusterKeySetReadParams alloc] init]; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; - [cluster - keySetReadWithParams:params - completionHandler:^(CHIPGroupKeyManagementClusterKeySetReadResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"KeySet Read (removed) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_NOT_FOUND); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000014_KeySetRead -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"KeySet Read (not removed)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupKeyManagementClusterKeySetReadParams alloc] init]; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:418U]; - [cluster - keySetReadWithParams:params - completionHandler:^(CHIPGroupKeyManagementClusterKeySetReadResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"KeySet Read (not removed) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.groupKeySet; - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).groupKeySetID unsignedShortValue], 418U); - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).groupKeySecurityPolicy unsignedCharValue], - 1); - XCTAssertTrue(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey0 == nil); - XCTAssertFalse(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime0 == nil); - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime0 unsignedLongLongValue], - 2110000ULL); - XCTAssertTrue(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey1 == nil); - XCTAssertFalse(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime1 == nil); - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime1 unsignedLongLongValue], - 2110001ULL); - XCTAssertTrue(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey2 == nil); - XCTAssertFalse(((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime2 == nil); - XCTAssertEqual( - [((CHIPGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime2 unsignedLongLongValue], - 2110002ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000015_RemoveAllGroups -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Remove All"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroups * cluster = [[CHIPTestGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster removeAllGroupsWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Remove All Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000016_KeySetRemove -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"KeySet Remove 2"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupKeyManagementClusterKeySetRemoveParams alloc] init]; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:418U]; - [cluster keySetRemoveWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"KeySet Remove 2 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGroupKeyManagementCluster_000017_KeySetRead -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"KeySet Read (also removed)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGroupKeyManagement * cluster = [[CHIPTestGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPGroupKeyManagementClusterKeySetReadParams alloc] init]; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:418U]; - [cluster - keySetReadWithParams:params - completionHandler:^(CHIPGroupKeyManagementClusterKeySetReadResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"KeySet Read (also removed) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_NOT_FOUND); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestIdentifyCluster_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)testSendClusterTestIdentifyCluster_000001_Identify -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Identify command and expect success response"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPIdentifyClusterIdentifyParams alloc] init]; - params.identifyTime = [NSNumber numberWithUnsignedShort:0U]; - [cluster identifyWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Identify command and expect success response Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestLogCommands_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)testSendClusterTestLogCommands_000001_Log -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Log a simple message"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Log(expectation, queue, @"This is a simple message"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestLogCommands_000002_UserPrompt -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Do a simple user prompt message"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - UserPrompt(expectation, queue, @"This is a simple message"); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestOperationalCredentialsCluster_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)testSendClusterTestOperationalCredentialsCluster_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read number of supported fabrics"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOperationalCredentials * cluster = [[CHIPTestOperationalCredentials alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSupportedFabricsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read number of supported fabrics Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 4); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestOperationalCredentialsCluster_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read number of commissioned fabrics"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOperationalCredentials * cluster = [[CHIPTestOperationalCredentials alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCommissionedFabricsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read number of commissioned fabrics Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 1); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull ourFabricIndex; -- (void)testSendClusterTestOperationalCredentialsCluster_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read current fabric index"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOperationalCredentials * cluster = [[CHIPTestOperationalCredentials alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentFabricIndexWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read current fabric index Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 1); - } - } - { - id actualValue = value; - ourFabricIndex = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestOperationalCredentialsCluster_000004_RemoveFabric -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Remove nonexistent fabric"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOperationalCredentials * cluster = [[CHIPTestOperationalCredentials alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPOperationalCredentialsClusterRemoveFabricParams alloc] init]; - params.fabricIndex = [NSNumber numberWithUnsignedChar:243]; - [cluster - removeFabricWithParams:params - completionHandler:^(CHIPOperationalCredentialsClusterNOCResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Remove nonexistent fabric Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.statusCode; - XCTAssertEqual([actualValue unsignedCharValue], 11); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestOperationalCredentialsCluster_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read fabric list before setting label"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOperationalCredentials * cluster = [[CHIPTestOperationalCredentials alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster readAttributeFabricsWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read fabric list before setting label Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertTrue([((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label - isEqualToString:@""]); - XCTAssertEqualObjects( - ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).fabricIndex, - ourFabricIndex); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestOperationalCredentialsCluster_000006_UpdateFabricLabel -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Set the fabric label"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOperationalCredentials * cluster = [[CHIPTestOperationalCredentials alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPOperationalCredentialsClusterUpdateFabricLabelParams alloc] init]; - params.label = @"Batcave"; - [cluster updateFabricLabelWithParams:params - completionHandler:^( - CHIPOperationalCredentialsClusterNOCResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Set the fabric label Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = values.statusCode; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - { - id actualValue = values.fabricIndex; - XCTAssertEqualObjects(actualValue, ourFabricIndex); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestOperationalCredentialsCluster_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read fabric list after setting label"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOperationalCredentials * cluster = [[CHIPTestOperationalCredentials alloc] initWithDevice:device - endpoint:0 - queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster readAttributeFabricsWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read fabric list after setting label Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertTrue([((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).label - isEqualToString:@"Batcave"]); - XCTAssertEqualObjects( - ((CHIPOperationalCredentialsClusterFabricDescriptor *) actualValue[0]).fabricIndex, - ourFabricIndex); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestBinding_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)testSendClusterTestBinding_000001_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write empty binding table"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinding * cluster = [[CHIPTestBinding alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bindingArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - bindingArgument = temp_0; - } - [cluster writeAttributeBindingWithValue:bindingArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write empty binding table Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestBinding_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read empty binding table"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinding * cluster = [[CHIPTestBinding alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster readAttributeBindingWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read empty binding table Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestBinding_000003_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write invalid binding table"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinding * cluster = [[CHIPTestBinding alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bindingArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).node = [NSNumber numberWithUnsignedLongLong:1ULL]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).group = [NSNumber numberWithUnsignedShort:1U]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).endpoint = [NSNumber numberWithUnsignedShort:1U]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).cluster = [NSNumber numberWithUnsignedInt:6UL]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - bindingArgument = temp_0; - } - [cluster writeAttributeBindingWithValue:bindingArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write invalid binding table Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestBinding_000004_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write binding table (endpoint 1)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinding * cluster = [[CHIPTestBinding alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id bindingArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).group = [NSNumber numberWithUnsignedShort:1U]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[1] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).node = [NSNumber numberWithUnsignedLongLong:1ULL]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).endpoint = [NSNumber numberWithUnsignedShort:1U]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).cluster = [NSNumber numberWithUnsignedInt:6UL]; - ((CHIPBindingClusterTargetStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - temp_0[2] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[2]).node = [NSNumber numberWithUnsignedLongLong:2ULL]; - ((CHIPBindingClusterTargetStruct *) temp_0[2]).endpoint = [NSNumber numberWithUnsignedShort:1U]; - ((CHIPBindingClusterTargetStruct *) temp_0[2]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - bindingArgument = temp_0; - } - [cluster writeAttributeBindingWithValue:bindingArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write binding table (endpoint 1) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestBinding_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read binding table (endpoint 1)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinding * cluster = [[CHIPTestBinding alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeBindingWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read binding table (endpoint 1) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 3); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).group unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).node unsignedLongLongValue], 1ULL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).endpoint unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).cluster unsignedIntValue], 6UL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex unsignedCharValue], 1); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).node unsignedLongLongValue], 2ULL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).endpoint unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestBinding_000006_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write binding table (endpoint 0)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinding * cluster = [[CHIPTestBinding alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id bindingArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPBindingClusterTargetStruct alloc] init]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).node = [NSNumber numberWithUnsignedLongLong:3ULL]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).endpoint = [NSNumber numberWithUnsignedShort:1U]; - ((CHIPBindingClusterTargetStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; - - bindingArgument = temp_0; - } - [cluster writeAttributeBindingWithValue:bindingArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write binding table (endpoint 0) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestBinding_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read binding table (endpoint 0)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinding * cluster = [[CHIPTestBinding alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeBindingWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read binding table (endpoint 0) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 1); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).node unsignedLongLongValue], 3ULL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).endpoint unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestBinding_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify endpoint 1 not changed"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBinding * cluster = [[CHIPTestBinding alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - CHIPReadParams * params = [[CHIPReadParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster - readAttributeBindingWithParams:params - completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify endpoint 1 not changed Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 3); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).group unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[0]).fabricIndex unsignedCharValue], 1); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).node unsignedLongLongValue], 1ULL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).endpoint unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).cluster unsignedIntValue], 6UL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[1]).fabricIndex unsignedCharValue], 1); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).node unsignedLongLongValue], 2ULL); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).endpoint unsignedShortValue], 1U); - XCTAssertEqual([((CHIPBindingClusterTargetStruct *) actualValue[2]).fabricIndex unsignedCharValue], 1); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestUserLabelCluster_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)testSendClusterTestUserLabelCluster_000001_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Clear User Label List"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestUserLabel * cluster = [[CHIPTestUserLabel alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id labelListArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - labelListArgument = temp_0; - } - [cluster writeAttributeLabelListWithValue:labelListArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Clear User Label List Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestUserLabelCluster_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read User Label List"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestUserLabel * cluster = [[CHIPTestUserLabel alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLabelListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read User Label List Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestUserLabelCluster_000003_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write User Label List"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestUserLabel * cluster = [[CHIPTestUserLabel alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id labelListArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[CHIPUserLabelClusterLabelStruct alloc] init]; - ((CHIPUserLabelClusterLabelStruct *) temp_0[0]).label = @"room"; - ((CHIPUserLabelClusterLabelStruct *) temp_0[0]).value = @"bedroom 2"; - - temp_0[1] = [[CHIPUserLabelClusterLabelStruct alloc] init]; - ((CHIPUserLabelClusterLabelStruct *) temp_0[1]).label = @"orientation"; - ((CHIPUserLabelClusterLabelStruct *) temp_0[1]).value = @"North"; - - temp_0[2] = [[CHIPUserLabelClusterLabelStruct alloc] init]; - ((CHIPUserLabelClusterLabelStruct *) temp_0[2]).label = @"floor"; - ((CHIPUserLabelClusterLabelStruct *) temp_0[2]).value = @"5"; - - temp_0[3] = [[CHIPUserLabelClusterLabelStruct alloc] init]; - ((CHIPUserLabelClusterLabelStruct *) temp_0[3]).label = @"direction"; - ((CHIPUserLabelClusterLabelStruct *) temp_0[3]).value = @"up"; - - labelListArgument = temp_0; - } - [cluster writeAttributeLabelListWithValue:labelListArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write User Label List Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestUserLabelCluster_000004_Reboot -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reboot target device"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - Reboot(expectation, queue, 3840); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestUserLabelCluster_000005_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)testSendClusterTestUserLabelCluster_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestUserLabel * cluster = [[CHIPTestUserLabel alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeLabelListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 4); - XCTAssertTrue([((CHIPUserLabelClusterLabelStruct *) actualValue[0]).label isEqualToString:@"room"]); - XCTAssertTrue([((CHIPUserLabelClusterLabelStruct *) actualValue[0]).value isEqualToString:@"bedroom 2"]); - XCTAssertTrue([((CHIPUserLabelClusterLabelStruct *) actualValue[1]).label isEqualToString:@"orientation"]); - XCTAssertTrue([((CHIPUserLabelClusterLabelStruct *) actualValue[1]).value isEqualToString:@"North"]); - XCTAssertTrue([((CHIPUserLabelClusterLabelStruct *) actualValue[2]).label isEqualToString:@"floor"]); - XCTAssertTrue([((CHIPUserLabelClusterLabelStruct *) actualValue[2]).value isEqualToString:@"5"]); - XCTAssertTrue([((CHIPUserLabelClusterLabelStruct *) actualValue[3]).label isEqualToString:@"direction"]); - XCTAssertTrue([((CHIPUserLabelClusterLabelStruct *) actualValue[3]).value isEqualToString:@"up"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_SWDIAG_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_SWDIAG_1_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads a list of ThreadMetrics struct non-global attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeThreadMetricsWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads a list of ThreadMetrics struct non-global attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWDIAG_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads CurrentHeapFree non-global attribute value from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentHeapFreeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentHeapFree non-global attribute value from DUT Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWDIAG_1_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads CurrentHeapUsed non-global attribute value from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentHeapUsedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentHeapUsed non-global attribute value from DUT Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWDIAG_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads CurrentHeapHighWaterMark non-global attribute value from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentHeapHighWatermarkWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentHeapHighWaterMark non-global attribute value from DUT Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTest_TC_SWDIAG_3_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_SWDIAG_3_1_000001_ResetWatermarks -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ResetWatermarks to DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster resetWatermarksWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ResetWatermarks to DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWDIAG_3_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentHeapUsed attribute value from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentHeapUsedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentHeapUsed attribute value from DUT Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_SWDIAG_3_1_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentHeapHighWaterMark attribute value from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentHeapHighWatermarkWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentHeapHighWaterMark attribute value from DUT Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestSubscribe_OnOff_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)testSendClusterTestSubscribe_OnOff_000001_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Set OnOff Attribute to false"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Set OnOff Attribute to false Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -bool testSendClusterTestSubscribe_OnOff_000002_WaitForReport_Fulfilled = false; -ResponseHandler test_TestSubscribe_OnOff_OnOff_Reported = nil; -- (void)testSendClusterTestSubscribe_OnOff_000002_WaitForReport -{ - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - test_TestSubscribe_OnOff_OnOff_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Report: Subscribe OnOff Attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], false); - } - - testSendClusterTestSubscribe_OnOff_000002_WaitForReport_Fulfilled = true; - }; -} -- (void)testSendClusterTestSubscribe_OnOff_000003_SubscribeAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Subscribe OnOff Attribute"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint16_t minIntervalArgument = 2U; - uint16_t maxIntervalArgument = 5U; - CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - params.fabricFiltered = [NSNumber numberWithBool:true]; - [cluster subscribeAttributeOnOffWithMinInterval:@(minIntervalArgument) - maxInterval:@(maxIntervalArgument) - params:params - subscriptionEstablished:^{ - XCTAssertEqual(testSendClusterTestSubscribe_OnOff_000002_WaitForReport_Fulfilled, true); - [expectation fulfill]; - } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Subscribe OnOff Attribute Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - if (test_TestSubscribe_OnOff_OnOff_Reported != nil) { - ResponseHandler callback = test_TestSubscribe_OnOff_OnOff_Reported; - test_TestSubscribe_OnOff_OnOff_Reported = nil; - callback(value, err); - } - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSubscribe_OnOff_000004_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn On the light to see attribute change"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn On the light to see attribute change Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSubscribe_OnOff_000005_WaitForReport -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check for attribute report"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - test_TestSubscribe_OnOff_OnOff_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check for attribute report Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], true); - } - - [expectation fulfill]; - }; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSubscribe_OnOff_000006_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn Off the light to see attribute change"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Turn Off the light to see attribute change Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestSubscribe_OnOff_000007_WaitForReport -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Check for attribute report"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - test_TestSubscribe_OnOff_OnOff_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check for attribute report Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue boolValue], false); - } - - [expectation fulfill]; - }; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - @end diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm index dfcc84369068fb..2d08885cf28f64 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm @@ -24,7 +24,7 @@ #import "CHIPDevice.h" #import "CHIPDevice_Internal.h" -#import "zap-generated/CHIPTestClustersObjc.h" +#import "zap-generated/cluster/CHIPTestClustersObjc.h" #import "zap-generated/tests/CHIPClustersTest.h" #include 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 9606506ee4f4dd..3ee27ca7befd90 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -47355,7 +47355,7 @@ class Test_TC_WNCV_3_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - bool testSendClusterTest_TC_WNCV_3_1_000007_WaitForReport_Fulfilled = false; + bool testSendClusterTest_TC_WNCV_3_1_7_WaitForReport_Fulfilled = false; ResponseHandler _Nullable test_Test_TC_WNCV_3_1_OperationalStatus_Reported = nil; CHIP_ERROR TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_7() @@ -47370,7 +47370,7 @@ class Test_TC_WNCV_3_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - testSendClusterTest_TC_WNCV_3_1_000007_WaitForReport_Fulfilled = true; + testSendClusterTest_TC_WNCV_3_1_7_WaitForReport_Fulfilled = true; }; NextTest(); @@ -47390,8 +47390,8 @@ class Test_TC_WNCV_3_1 : public TestCommandBridge { maxInterval:[NSNumber numberWithUnsignedInt:maxIntervalArgument] params:params subscriptionEstablished:^{ - VerifyOrReturn(testSendClusterTest_TC_WNCV_3_1_000007_WaitForReport_Fulfilled, - SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + VerifyOrReturn( + testSendClusterTest_TC_WNCV_3_1_7_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); NextTest(); } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -48071,7 +48071,7 @@ class Test_TC_WNCV_3_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - bool testSendClusterTest_TC_WNCV_3_2_000007_WaitForReport_Fulfilled = false; + bool testSendClusterTest_TC_WNCV_3_2_7_WaitForReport_Fulfilled = false; ResponseHandler _Nullable test_Test_TC_WNCV_3_2_OperationalStatus_Reported = nil; CHIP_ERROR TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_7() @@ -48086,7 +48086,7 @@ class Test_TC_WNCV_3_2 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - testSendClusterTest_TC_WNCV_3_2_000007_WaitForReport_Fulfilled = true; + testSendClusterTest_TC_WNCV_3_2_7_WaitForReport_Fulfilled = true; }; NextTest(); @@ -48106,8 +48106,8 @@ class Test_TC_WNCV_3_2 : public TestCommandBridge { maxInterval:[NSNumber numberWithUnsignedInt:maxIntervalArgument] params:params subscriptionEstablished:^{ - VerifyOrReturn(testSendClusterTest_TC_WNCV_3_2_000007_WaitForReport_Fulfilled, - SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + VerifyOrReturn( + testSendClusterTest_TC_WNCV_3_2_7_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); NextTest(); } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -48629,7 +48629,7 @@ class Test_TC_WNCV_3_3 : public TestCommandBridge { WaitForMs(2000); return CHIP_NO_ERROR; } - bool testSendClusterTest_TC_WNCV_3_3_000005_WaitForReport_Fulfilled = false; + bool testSendClusterTest_TC_WNCV_3_3_5_WaitForReport_Fulfilled = false; ResponseHandler _Nullable test_Test_TC_WNCV_3_3_OperationalStatus_Reported = nil; CHIP_ERROR TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_5() @@ -48644,7 +48644,7 @@ class Test_TC_WNCV_3_3 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - testSendClusterTest_TC_WNCV_3_3_000005_WaitForReport_Fulfilled = true; + testSendClusterTest_TC_WNCV_3_3_5_WaitForReport_Fulfilled = true; }; NextTest(); @@ -48664,8 +48664,8 @@ class Test_TC_WNCV_3_3 : public TestCommandBridge { maxInterval:[NSNumber numberWithUnsignedInt:maxIntervalArgument] params:params subscriptionEstablished:^{ - VerifyOrReturn(testSendClusterTest_TC_WNCV_3_3_000005_WaitForReport_Fulfilled, - SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + VerifyOrReturn( + testSendClusterTest_TC_WNCV_3_3_5_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); NextTest(); } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -64617,7 +64617,7 @@ class TestCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - bool testSendClusterTestCluster_000366_WaitForReport_Fulfilled = false; + bool testSendClusterTestCluster_366_WaitForReport_Fulfilled = false; ResponseHandler _Nullable test_TestCluster_list_int8u_Reported = nil; CHIP_ERROR TestReportSubscribeToListAttribute_366() @@ -64640,7 +64640,7 @@ class TestCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("", actualValue[3], 4)); } - testSendClusterTestCluster_000366_WaitForReport_Fulfilled = true; + testSendClusterTestCluster_366_WaitForReport_Fulfilled = true; }; NextTest(); @@ -64661,7 +64661,7 @@ class TestCluster : public TestCommandBridge { params:params subscriptionEstablished:^{ VerifyOrReturn( - testSendClusterTestCluster_000366_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + testSendClusterTestCluster_366_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); NextTest(); } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -74254,7 +74254,7 @@ class TestSubscribe_OnOff : public TestCommandBridge { return CHIP_NO_ERROR; } - bool testSendClusterTestSubscribe_OnOff_000002_WaitForReport_Fulfilled = false; + bool testSendClusterTestSubscribe_OnOff_2_WaitForReport_Fulfilled = false; ResponseHandler _Nullable test_TestSubscribe_OnOff_OnOff_Reported = nil; CHIP_ERROR TestReportSubscribeOnOffAttribute_2() @@ -74273,7 +74273,7 @@ class TestSubscribe_OnOff : public TestCommandBridge { VerifyOrReturn(CheckValue("OnOff", actualValue, false)); } - testSendClusterTestSubscribe_OnOff_000002_WaitForReport_Fulfilled = true; + testSendClusterTestSubscribe_OnOff_2_WaitForReport_Fulfilled = true; }; NextTest(); @@ -74293,8 +74293,8 @@ class TestSubscribe_OnOff : public TestCommandBridge { maxInterval:[NSNumber numberWithUnsignedInt:maxIntervalArgument] params:params subscriptionEstablished:^{ - VerifyOrReturn(testSendClusterTestSubscribe_OnOff_000002_WaitForReport_Fulfilled, - SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + VerifyOrReturn( + testSendClusterTestSubscribe_OnOff_2_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); NextTest(); } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) {