From 707d60b458d1a1544f4cd8f8dee51fd68059583f Mon Sep 17 00:00:00 2001 From: Jeff Tung Date: Tue, 5 Jul 2022 21:51:54 -0700 Subject: [PATCH 1/5] parent c2dd36be506f68804b66ada78d5c94ce89556dbd author Jeff Tung 1657083114 -0700 committer Jeff Tung 1657128282 -0700 Issue 20336 - Darwin: rename MTRDevice and MTRClsutersObjc files and classes --- .restyled.yaml | 2 +- .../Framework Helpers/DefaultsUtils.h | 2 +- .../Framework Helpers/DefaultsUtils.m | 11 +- .../Bindings/BindingsViewController.m | 4 +- .../Enumeration/EnumerateViewController.m | 15 +- .../Fabric/FabricUIViewController.m | 45 +- .../MultiAdmin/MultiAdminViewController.m | 2 +- .../OnOffCluster/OnOffViewController.m | 24 +- .../QRCode/QRCodeViewController.m | 4 +- .../TemperatureSensorViewController.m | 13 +- .../CHIP/MTRAttributeCacheContainer.mm | 2 +- .../CHIP/{MTRDevice.h => MTRBaseDevice.h} | 2 +- .../CHIP/{MTRDevice.mm => MTRBaseDevice.mm} | 6 +- ...ce_Internal.h => MTRBaseDevice_Internal.h} | 4 +- .../CHIP/MTRCallbackBridgeBase_internal.h | 2 +- src/darwin/Framework/CHIP/MTRCluster.h | 2 +- src/darwin/Framework/CHIP/MTRCluster.mm | 2 +- .../Framework/CHIP/MTRCluster_internal.h | 6 +- .../CHIP/MTRDeviceConnectionBridge.mm | 4 +- .../Framework/CHIP/MTRDeviceController+XPC.m | 2 +- .../Framework/CHIP/MTRDeviceController.h | 6 +- .../Framework/CHIP/MTRDeviceController.mm | 8 +- .../CHIP/MTRDeviceControllerOverXPC.m | 2 +- src/darwin/Framework/CHIP/MTRDeviceOverXPC.h | 4 +- src/darwin/Framework/CHIP/Matter.h | 4 +- ...Objc-src.zapt => MTRBaseClusters-src.zapt} | 14 +- ...ClustersObjc.zapt => MTRBaseClusters.zapt} | 4 +- ...nal.zapt => MTRBaseClusters_internal.zapt} | 7 +- .../Framework/CHIP/templates/templates.json | 12 +- .../{MTRClustersObjc.h => MTRBaseClusters.h} | 256 +++++------ ...{MTRClustersObjc.mm => MTRBaseClusters.mm} | 262 +++++------ .../zap-generated/MTRBaseClusters_internal.h | 409 ++++++++++++++++++ .../Framework/CHIPTests/MTRClustersTests.m | 6 +- .../Framework/CHIPTests/MTRControllerTests.m | 2 +- .../Framework/CHIPTests/MTRDeviceTests.m | 124 +++--- .../CHIPTests/MTRXPCListenerSampleTests.m | 122 +++--- .../Framework/CHIPTests/MTRXPCProtocolTests.m | 70 +-- .../Matter.xcodeproj/project.pbxproj | 44 +- 38 files changed, 967 insertions(+), 543 deletions(-) rename src/darwin/Framework/CHIP/{MTRDevice.h => MTRBaseDevice.h} (99%) rename src/darwin/Framework/CHIP/{MTRDevice.mm => MTRBaseDevice.mm} (99%) rename src/darwin/Framework/CHIP/{MTRDevice_Internal.h => MTRBaseDevice_Internal.h} (96%) rename src/darwin/Framework/CHIP/templates/{MTRClustersObjc-src.zapt => MTRBaseClusters-src.zapt} (97%) rename src/darwin/Framework/CHIP/templates/{MTRClustersObjc.zapt => MTRBaseClusters.zapt} (96%) rename src/darwin/Framework/CHIP/templates/{MTRClustersObjc_internal.zapt => MTRBaseClusters_internal.zapt} (66%) rename src/darwin/Framework/CHIP/zap-generated/{MTRClustersObjc.h => MTRBaseClusters.h} (99%) rename src/darwin/Framework/CHIP/zap-generated/{MTRClustersObjc.mm => MTRBaseClusters.mm} (99%) create mode 100644 src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h diff --git a/.restyled.yaml b/.restyled.yaml index 95780a56920d35..c45fe98588b7ec 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -72,7 +72,7 @@ exclude: - "scripts/idl/tests/outputs/**/*" # Matches generated output 1:1 - "examples/chef/sample_app_util/test_files/*.yaml" - "examples/chef/zzz_generated/**/*" - - "src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.mm" # https://github.com/project-chip/connectedhomeip/issues/20236 + - "src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm" # https://github.com/project-chip/connectedhomeip/issues/20236 changed_paths: diff --git a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h index 8b3320ec2992b5..e4f114bc4ab869 100644 --- a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h +++ b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h @@ -39,7 +39,7 @@ BOOL MTRIsDevicePaired(uint64_t id); BOOL MTRGetConnectedDevice(MTRDeviceConnectionCallback completionHandler); BOOL MTRGetConnectedDeviceWithID(uint64_t deviceId, MTRDeviceConnectionCallback completionHandler); void MTRUnpairDeviceWithID(uint64_t deviceId); -MTRDevice * _Nullable MTRGetDeviceBeingCommissioned(void); +MTRBaseDevice * _Nullable MTRGetDeviceBeingCommissioned(void); @interface CHIPToolPersistentStorageDelegate : NSObject - (nullable NSData *)storageDataForKey:(NSString *)key; diff --git a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m index bdf66f2db41a7d..31229d8a47eb35 100644 --- a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m +++ b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m @@ -138,11 +138,11 @@ BOOL MTRGetConnectedDevice(MTRDeviceConnectionCallback completionHandler) return [controller getDevice:deviceId queue:dispatch_get_main_queue() completionHandler:completionHandler]; } -MTRDevice * MTRGetDeviceBeingCommissioned(void) +MTRBaseDevice * MTRGetDeviceBeingCommissioned(void) { NSError * error; MTRDeviceController * controller = InitializeMTR(); - MTRDevice * device = [controller getDeviceBeingCommissioned:MTRGetLastPairedDeviceId() error:&error]; + MTRBaseDevice * device = [controller getDeviceBeingCommissioned:MTRGetLastPairedDeviceId() error:&error]; if (error) { NSLog(@"Error retrieving device being commissioned for deviceId %llu", MTRGetLastPairedDeviceId()); return nil; @@ -173,15 +173,14 @@ void MTRSetDevicePaired(uint64_t deviceId, BOOL paired) void MTRUnpairDeviceWithID(uint64_t deviceId) { MTRSetDevicePaired(deviceId, NO); - MTRGetConnectedDeviceWithID(deviceId, ^(MTRDevice * _Nullable device, NSError * _Nullable error) { + MTRGetConnectedDeviceWithID(deviceId, ^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSLog(@"Failed to unpair device %llu still removing from CHIPTool. %@", deviceId, error); return; } NSLog(@"Attempting to unpair device %llu", deviceId); - MTROperationalCredentials * opCredsCluster = [[MTROperationalCredentials alloc] initWithDevice:device - endpoint:0 - queue:dispatch_get_main_queue()]; + MTRBaseClusterOperationalCredentials * opCredsCluster = + [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpoint:0 queue:dispatch_get_main_queue()]; [opCredsCluster readAttributeCurrentFabricIndexWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { if (error) { diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Bindings/BindingsViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/Bindings/BindingsViewController.m index 4e31fc87ca32e5..b98e45ec0d8749 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Bindings/BindingsViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Bindings/BindingsViewController.m @@ -134,7 +134,7 @@ - (IBAction)bind:(id)sender [scanner scanUnsignedLongLong:&nodeId]; // TODO Binding Support was removed from ObjC Clusters.h - if (MTRGetConnectedDevice(^(MTRDevice * _Nullable chipDevice, NSError * _Nullable error) { + if (MTRGetConnectedDevice(^(MTRBaseDevice * _Nullable chipDevice, NSError * _Nullable error) { if (chipDevice) { NSString * resultString = [NSString stringWithFormat:@"Not Supported"]; NSLog(resultString, nil); @@ -150,7 +150,7 @@ - (IBAction)bind:(id)sender - (IBAction)unbind:(id)sender { - if (MTRGetConnectedDevice(^(MTRDevice * _Nullable chipDevice, NSError * _Nullable error) { + if (MTRGetConnectedDevice(^(MTRBaseDevice * _Nullable chipDevice, NSError * _Nullable error) { if (chipDevice) { NSString * resultString = [NSString stringWithFormat:@"Not Supported"]; NSLog(resultString, nil); diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Enumeration/EnumerateViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/Enumeration/EnumerateViewController.m index e8f9d37e6cb4dc..8d6441fc078488 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Enumeration/EnumerateViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Enumeration/EnumerateViewController.m @@ -108,16 +108,16 @@ - (IBAction)sendMessage:(id)sender // 4. Success? - (void)enumerate { - MTRGetConnectedDevice(^(MTRDevice * _Nullable device, NSError * _Nullable error) { + MTRGetConnectedDevice(^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSString * resultLog = [[NSString alloc] initWithFormat:@"Unable to get connected device: Error: %@", error]; [self updateResult:resultLog]; return; } - MTRDescriptor * descriptorCluster = [[MTRDescriptor alloc] initWithDevice:device - endpoint:0 - queue:dispatch_get_main_queue()]; + MTRBaseClusterDescriptor * descriptorCluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpoint:0 + queue:dispatch_get_main_queue()]; NSLog(@"Reading parts list to get list of endpoints in use..."); [descriptorCluster readAttributePartsListWithCompletionHandler:^( NSArray * _Nullable endpointsInUse, NSError * _Nullable error) { @@ -131,9 +131,10 @@ - (void)enumerate [self updateResult:resultLog]; for (NSNumber * endpoint in endpointsInUse) { - MTRDescriptor * descriptorCluster = [[MTRDescriptor alloc] initWithDevice:device - endpoint:[endpoint unsignedShortValue] - queue:dispatch_get_main_queue()]; + MTRBaseClusterDescriptor * descriptorCluster = + [[MTRBaseClusterDescriptor alloc] initWithDevice:device + endpoint:[endpoint unsignedShortValue] + queue:dispatch_get_main_queue()]; [descriptorCluster readAttributeDeviceListWithCompletionHandler:^( NSArray * _Nullable value, NSError * _Nullable error) { if (error) { diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m index 6d281c0312d80f..39f0f1a35977ee 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m @@ -217,11 +217,12 @@ - (void)updateFabricsListUIWithFabrics:(NSArray #import "MTRAttributeCacheContainer_Internal.h" +#import "MTRBaseDevice_Internal.h" #import "MTRCluster.h" #import "MTRDeviceControllerXPCConnection.h" -#import "MTRDevice_Internal.h" #import "MTRError.h" #import "MTRError_Internal.h" #import "MTRLogging.h" diff --git a/src/darwin/Framework/CHIP/MTRDevice.h b/src/darwin/Framework/CHIP/MTRBaseDevice.h similarity index 99% rename from src/darwin/Framework/CHIP/MTRDevice.h rename to src/darwin/Framework/CHIP/MTRBaseDevice.h index 3230b26a15dedf..815e37c3c7d655 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.h +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.h @@ -90,7 +90,7 @@ extern NSString * const MTRArrayValueType; @class MTRReadParams; @class MTRSubscribeParams; -@interface MTRDevice : NSObject +@interface MTRBaseDevice : NSObject - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm similarity index 99% rename from src/darwin/Framework/CHIP/MTRDevice.mm rename to src/darwin/Framework/CHIP/MTRBaseDevice.mm index 9cc39ad8aa581a..c1a54ac7b6983d 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -17,9 +17,9 @@ #import "MTRAttributeCacheContainer_Internal.h" #import "MTRAttributeTLVValueDecoder_Internal.h" +#import "MTRBaseDevice_Internal.h" #import "MTRCallbackBridgeBase_internal.h" #import "MTRCluster.h" -#import "MTRDevice_Internal.h" #import "MTRError_Internal.h" #import "MTREventTLVValueDecoder_Internal.h" #import "MTRLogging.h" @@ -65,7 +65,7 @@ class NSObjectDataValueCallbackBridge; -@interface MTRDevice () +@interface MTRBaseDevice () @property (nonatomic, readonly, strong, nonnull) NSRecursiveLock * lock; @property (readonly) chip::DeviceProxy * cppDevice; @@ -221,7 +221,7 @@ - (void)dealloc } @end -@implementation MTRDevice +@implementation MTRBaseDevice - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h similarity index 96% rename from src/darwin/Framework/CHIP/MTRDevice_Internal.h rename to src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h index 7dea9c4a92b152..0bc99ae0c3c7ba 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h @@ -15,7 +15,7 @@ * limitations under the License. */ -#import "MTRDevice.h" +#import "MTRBaseDevice.h" #import #include @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface MTRDevice () +@interface MTRBaseDevice () - (instancetype)initWithDevice:(chip::DeviceProxy *)device; - (chip::DeviceProxy *)internalDevice; diff --git a/src/darwin/Framework/CHIP/MTRCallbackBridgeBase_internal.h b/src/darwin/Framework/CHIP/MTRCallbackBridgeBase_internal.h index fe7ded16cb7e57..61bc9f41de3676 100644 --- a/src/darwin/Framework/CHIP/MTRCallbackBridgeBase_internal.h +++ b/src/darwin/Framework/CHIP/MTRCallbackBridgeBase_internal.h @@ -18,7 +18,7 @@ #import #import "MTRError_Internal.h" -#import "zap-generated/MTRClustersObjc.h" +#import "zap-generated/MTRBaseClusters.h" #include #include diff --git a/src/darwin/Framework/CHIP/MTRCluster.h b/src/darwin/Framework/CHIP/MTRCluster.h index d7cc4e1c810af5..3517772447353e 100644 --- a/src/darwin/Framework/CHIP/MTRCluster.h +++ b/src/darwin/Framework/CHIP/MTRCluster.h @@ -17,7 +17,7 @@ #import -@class MTRDevice; +@class MTRBaseDevice; NS_ASSUME_NONNULL_BEGIN diff --git a/src/darwin/Framework/CHIP/MTRCluster.mm b/src/darwin/Framework/CHIP/MTRCluster.mm index 384c509565420d..17d943996bdba8 100644 --- a/src/darwin/Framework/CHIP/MTRCluster.mm +++ b/src/darwin/Framework/CHIP/MTRCluster.mm @@ -15,8 +15,8 @@ * limitations under the License. */ +#import "MTRBaseDevice.h" #import "MTRCluster_internal.h" -#import "MTRDevice.h" #import "NSDataSpanConversion.h" using namespace ::chip; diff --git a/src/darwin/Framework/CHIP/MTRCluster_internal.h b/src/darwin/Framework/CHIP/MTRCluster_internal.h index 2ef58581c9e6f8..615b8eb732b48d 100644 --- a/src/darwin/Framework/CHIP/MTRCluster_internal.h +++ b/src/darwin/Framework/CHIP/MTRCluster_internal.h @@ -17,12 +17,12 @@ #import +#import "MTRBaseDevice.h" +#import "MTRBaseDevice_Internal.h" #import "MTRCluster.h" -#import "MTRDevice.h" -#import "MTRDevice_Internal.h" #import "zap-generated/CHIPClusters.h" -#import "zap-generated/MTRClustersObjc.h" +#import "zap-generated/MTRBaseClusters.h" NS_ASSUME_NONNULL_BEGIN diff --git a/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm index 6972ae7f788698..2ad2c2f6c08f83 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm @@ -16,13 +16,13 @@ */ #import "MTRDeviceConnectionBridge.h" -#import "MTRDevice_Internal.h" +#import "MTRBaseDevice_Internal.h" #import "MTRError_Internal.h" void MTRDeviceConnectionBridge::OnConnected(void * context, chip::OperationalDeviceProxy * device) { auto * object = static_cast(context); - MTRDevice * chipDevice = [[MTRDevice alloc] initWithDevice:device]; + MTRBaseDevice * chipDevice = [[MTRBaseDevice alloc] initWithDevice:device]; dispatch_async(object->mQueue, ^{ object->mCompletionHandler(chipDevice, nil); object->Release(); diff --git a/src/darwin/Framework/CHIP/MTRDeviceController+XPC.m b/src/darwin/Framework/CHIP/MTRDeviceController+XPC.m index 717bbff4628703..6dc425eba5cd7c 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController+XPC.m +++ b/src/darwin/Framework/CHIP/MTRDeviceController+XPC.m @@ -17,8 +17,8 @@ #import "MTRDeviceController+XPC.h" +#import "MTRBaseDevice.h" #import "MTRCluster.h" -#import "MTRDevice.h" #import "MTRDeviceControllerOverXPC.h" NS_ASSUME_NONNULL_BEGIN diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index c05e442328ea8c..13988df7f67a9c 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -19,11 +19,11 @@ #import -@class MTRDevice; +@class MTRBaseDevice; NS_ASSUME_NONNULL_BEGIN -typedef void (^MTRDeviceConnectionCallback)(MTRDevice * _Nullable device, NSError * _Nullable error); +typedef void (^MTRDeviceConnectionCallback)(MTRBaseDevice * _Nullable device, NSError * _Nullable error); @class MTRCommissioningParameters; @protocol MTRDevicePairingDelegate; @@ -92,7 +92,7 @@ typedef void (^MTRDeviceConnectionCallback)(MTRDevice * _Nullable device, NSErro - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *)error; -- (nullable MTRDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error; +- (nullable MTRBaseDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error; - (BOOL)getDevice:(uint64_t)deviceID queue:(dispatch_queue_t)queue completionHandler:(MTRDeviceConnectionCallback)completionHandler; - (BOOL)openPairingWindow:(uint64_t)deviceID duration:(NSUInteger)duration error:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 86e8b66aa0e771..a123b251f00dd5 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -16,12 +16,12 @@ */ #import "MTRDeviceController.h" +#import "MTRBaseDevice_Internal.h" #import "MTRCommissioningParameters.h" #import "MTRControllerFactory_Internal.h" #import "MTRDeviceControllerStartupParams.h" #import "MTRDeviceControllerStartupParams_Internal.h" #import "MTRDevicePairingDelegateBridge.h" -#import "MTRDevice_Internal.h" #import "MTRError_Internal.h" #import "MTRKeypair.h" #import "MTRLogging.h" @@ -32,7 +32,7 @@ #import "NSDataSpanConversion.h" #import #import -#import +#import #import "MTRDeviceAttestationDelegateBridge.h" #import "MTRDeviceConnectionBridge.h" @@ -498,7 +498,7 @@ - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *) return success; } -- (MTRDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error +- (MTRBaseDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error { CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE; if (![self isRunning]) { @@ -514,7 +514,7 @@ - (MTRDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __ } return nil; } - return [[MTRDevice alloc] initWithDevice:deviceProxy]; + return [[MTRBaseDevice alloc] initWithDevice:deviceProxy]; } - (BOOL)getDevice:(uint64_t)deviceID queue:(dispatch_queue_t)queue completionHandler:(MTRDeviceConnectionCallback)completionHandler diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m index a96c3ab65a9bbc..f0c8c68afc9f51 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m @@ -91,7 +91,7 @@ - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *) return NO; } -- (nullable MTRDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error +- (nullable MTRBaseDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error { MTR_LOG_ERROR("MTRDevice doesn't support getDeviceBeingCommissioned over XPC"); return nil; diff --git a/src/darwin/Framework/CHIP/MTRDeviceOverXPC.h b/src/darwin/Framework/CHIP/MTRDeviceOverXPC.h index 918ab8829d9f5d..e0a46f4f17cec5 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceOverXPC.h +++ b/src/darwin/Framework/CHIP/MTRDeviceOverXPC.h @@ -15,12 +15,12 @@ * limitations under the License. */ -#import "MTRDevice.h" +#import "MTRBaseDevice.h" #import "MTRDeviceControllerXPCConnection.h" NS_ASSUME_NONNULL_BEGIN -@interface MTRDeviceOverXPC : MTRDevice +@interface MTRDeviceOverXPC : MTRBaseDevice - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/Matter.h b/src/darwin/Framework/CHIP/Matter.h index 0d5e8c403e3e37..3f5856e892c8e6 100644 --- a/src/darwin/Framework/CHIP/Matter.h +++ b/src/darwin/Framework/CHIP/Matter.h @@ -18,14 +18,14 @@ #import #import +#import +#import #import #import #import -#import #import #import #import -#import #import #import #import diff --git a/src/darwin/Framework/CHIP/templates/MTRClustersObjc-src.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt similarity index 97% rename from src/darwin/Framework/CHIP/templates/MTRClustersObjc-src.zapt rename to src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt index 7e8152218b09a2..a120d05653a190 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClustersObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt @@ -3,11 +3,11 @@ #import #import "MTRAttributeCacheContainer_Internal.h" +#import "MTRBaseClusters_internal.h" +#import "MTRBaseDevice.h" +#import "MTRBaseDevice_Internal.h" #import "MTRCallbackBridge_internal.h" #import "MTRCluster_internal.h" -#import "MTRClustersObjc_internal.h" -#import "MTRDevice.h" -#import "MTRDevice_Internal.h" #import "MTRStructsObjc.h" #import "MTRCommandPayloadsObjc.h" @@ -20,9 +20,9 @@ using chip::Callback::Cancelable; using namespace chip::app::Clusters; // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. {{#chip_client_clusters includeAll=true}} -@implementation MTR{{asUpperCamelCase name}} +@implementation MTRBaseCluster{{asUpperCamelCase name}} -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -148,7 +148,7 @@ using namespace chip::app::Clusters; timedWriteTimeout.SetValue(10000); } {{/if}} - + new MTR{{>callbackName}}CallbackBridge(self.callbackQueue, {{! For now, don't change the bridge API; instead just use an adapter to invoke our completion handler. This is not great from a @@ -165,7 +165,7 @@ using namespace chip::app::Clusters; auto failureFn = Callback::FromCancelable(failure); return self.cppCluster->WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall, timedWriteTimeout); }); - + } {{/if}} diff --git a/src/darwin/Framework/CHIP/templates/MTRClustersObjc.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt similarity index 96% rename from src/darwin/Framework/CHIP/templates/MTRClustersObjc.zapt rename to src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt index e1fcaee949a99d..98adfc639f4bf0 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClustersObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt @@ -20,9 +20,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster {{name}} * {{description}} */ -@interface MTR{{asUpperCamelCase name}} : MTRCluster +@interface MTRBaseCluster{{asUpperCamelCase name}} : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; diff --git a/src/darwin/Framework/CHIP/templates/MTRClustersObjc_internal.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters_internal.zapt similarity index 66% rename from src/darwin/Framework/CHIP/templates/MTRClustersObjc_internal.zapt rename to src/darwin/Framework/CHIP/templates/MTRBaseClusters_internal.zapt index 134372f0d366a3..a86993b5977210 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClustersObjc_internal.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters_internal.zapt @@ -2,11 +2,14 @@ #import -#import "MTRDevice.h" +#import "MTRBaseClusters.h" +#import "MTRBaseDevice.h" + +#include {{#chip_client_clusters includeAll=true}} -@interface MTR{{asUpperCamelCase name}} () +@interface MTRBaseCluster{{asUpperCamelCase name}} () // Must only touch cppCluster on the Matter queue. @property (readonly) chip::Controller::{{asUpperCamelCase name}}Cluster * cppCluster; - (chip::Controller::{{asUpperCamelCase name}}Cluster **) cppClusterSlot; diff --git a/src/darwin/Framework/CHIP/templates/templates.json b/src/darwin/Framework/CHIP/templates/templates.json index 30e9f2926fe8aa..3939322c5601b3 100644 --- a/src/darwin/Framework/CHIP/templates/templates.json +++ b/src/darwin/Framework/CHIP/templates/templates.json @@ -53,19 +53,19 @@ "output": "src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm" }, { - "path": "MTRClustersObjc_internal.zapt", + "path": "MTRBaseClusters_internal.zapt", "name": "Objc ZCL API Internal Header", - "output": "src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc_internal.h" + "output": "src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h" }, { - "path": "MTRClustersObjc.zapt", + "path": "MTRBaseClusters.zapt", "name": "Objc ZCL API Header", - "output": "src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.h" + "output": "src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h" }, { - "path": "MTRClustersObjc-src.zapt", + "path": "MTRBaseClusters-src.zapt", "name": "Objc ZCL API", - "output": "src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.mm" + "output": "src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm" }, { "path": "MTRStructsObjc.zapt", diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h similarity index 99% rename from src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.h rename to src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 9aba082e93ca66..43ed2183d0a4f6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -34,9 +34,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Identify * */ -@interface MTRIdentify : MTRCluster +@interface MTRBaseClusterIdentify : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -184,9 +184,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Groups * */ -@interface MTRGroups : MTRCluster +@interface MTRBaseClusterGroups : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -325,9 +325,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Scenes * */ -@interface MTRScenes : MTRCluster +@interface MTRBaseClusterScenes : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -565,9 +565,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster On/Off * */ -@interface MTROnOff : MTRCluster +@interface MTRBaseClusterOnOff : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -779,9 +779,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster On/off Switch Configuration * */ -@interface MTROnOffSwitchConfiguration : MTRCluster +@interface MTRBaseClusterOnOffSwitchConfiguration : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -924,9 +924,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Level Control * */ -@interface MTRLevelControl : MTRCluster +@interface MTRBaseClusterLevelControl : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -1322,9 +1322,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Binary Input (Basic) * */ -@interface MTRBinaryInputBasic : MTRCluster +@interface MTRBaseClusterBinaryInputBasic : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -1608,9 +1608,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Descriptor * */ -@interface MTRDescriptor : MTRCluster +@interface MTRBaseClusterDescriptor : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -1778,9 +1778,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Binding * */ -@interface MTRBinding : MTRCluster +@interface MTRBaseClusterBinding : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -1904,9 +1904,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Access Control * */ -@interface MTRAccessControl : MTRCluster +@interface MTRBaseClusterAccessControl : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -2107,9 +2107,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Bridged Actions * */ -@interface MTRBridgedActions : MTRCluster +@interface MTRBaseClusterBridgedActions : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -2287,9 +2287,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Basic * */ -@interface MTRBasic : MTRCluster +@interface MTRBaseClusterBasic : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -2756,9 +2756,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster OTA Software Update Provider * */ -@interface MTROtaSoftwareUpdateProvider : MTRCluster +@interface MTRBaseClusterOtaSoftwareUpdateProvider : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -2871,9 +2871,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster OTA Software Update Requestor * */ -@interface MTROtaSoftwareUpdateRequestor : MTRCluster +@interface MTRBaseClusterOtaSoftwareUpdateRequestor : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -3058,9 +3058,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Localization Configuration * */ -@interface MTRLocalizationConfiguration : MTRCluster +@interface MTRBaseClusterLocalizationConfiguration : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -3204,9 +3204,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Time Format Localization * */ -@interface MTRTimeFormatLocalization : MTRCluster +@interface MTRBaseClusterTimeFormatLocalization : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -3372,9 +3372,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Unit Localization * */ -@interface MTRUnitLocalization : MTRCluster +@interface MTRBaseClusterUnitLocalization : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -3500,9 +3500,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Power Source Configuration * */ -@interface MTRPowerSourceConfiguration : MTRCluster +@interface MTRBaseClusterPowerSourceConfiguration : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -3621,9 +3621,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Power Source * */ -@interface MTRPowerSource : MTRCluster +@interface MTRBaseClusterPowerSource : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -4297,9 +4297,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster General Commissioning * */ -@interface MTRGeneralCommissioning : MTRCluster +@interface MTRBaseClusterGeneralCommissioning : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -4514,9 +4514,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Network Commissioning * */ -@interface MTRNetworkCommissioning : MTRCluster +@interface MTRBaseClusterNetworkCommissioning : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -4786,9 +4786,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Diagnostic Logs * */ -@interface MTRDiagnosticLogs : MTRCluster +@interface MTRBaseClusterDiagnosticLogs : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -4896,9 +4896,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster General Diagnostics * */ -@interface MTRGeneralDiagnostics : MTRCluster +@interface MTRBaseClusterGeneralDiagnostics : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -5166,9 +5166,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Software Diagnostics * */ -@interface MTRSoftwareDiagnostics : MTRCluster +@interface MTRBaseClusterSoftwareDiagnostics : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -5349,9 +5349,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Thread Network Diagnostics * */ -@interface MTRThreadNetworkDiagnostics : MTRCluster +@interface MTRBaseClusterThreadNetworkDiagnostics : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -6598,9 +6598,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster WiFi Network Diagnostics * */ -@interface MTRWiFiNetworkDiagnostics : MTRCluster +@interface MTRBaseClusterWiFiNetworkDiagnostics : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -6939,9 +6939,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Ethernet Network Diagnostics * */ -@interface MTREthernetNetworkDiagnostics : MTRCluster +@interface MTRBaseClusterEthernetNetworkDiagnostics : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -7207,9 +7207,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Bridged Device Basic * */ -@interface MTRBridgedDeviceBasic : MTRCluster +@interface MTRBaseClusterBridgedDeviceBasic : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -7577,9 +7577,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Switch * */ -@interface MTRSwitch : MTRCluster +@interface MTRBaseClusterSwitch : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -7737,9 +7737,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster AdministratorCommissioning * */ -@interface MTRAdministratorCommissioning : MTRCluster +@interface MTRBaseClusterAdministratorCommissioning : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -7905,9 +7905,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Operational Credentials * */ -@interface MTROperationalCredentials : MTRCluster +@interface MTRBaseClusterOperationalCredentials : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -8141,9 +8141,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Group Key Management * */ -@interface MTRGroupKeyManagement : MTRCluster +@interface MTRBaseClusterGroupKeyManagement : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -8332,9 +8332,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Fixed Label * */ -@interface MTRFixedLabel : MTRCluster +@interface MTRBaseClusterFixedLabel : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -8454,9 +8454,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster User Label * */ -@interface MTRUserLabel : MTRCluster +@interface MTRBaseClusterUserLabel : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -8580,9 +8580,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Boolean State * */ -@interface MTRBooleanState : MTRCluster +@interface MTRBaseClusterBooleanState : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -8703,9 +8703,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Mode Select * */ -@interface MTRModeSelect : MTRCluster +@interface MTRBaseClusterModeSelect : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -8922,9 +8922,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Door Lock * */ -@interface MTRDoorLock : MTRCluster +@interface MTRBaseClusterDoorLock : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -9806,9 +9806,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Window Covering * */ -@interface MTRWindowCovering : MTRCluster +@interface MTRBaseClusterWindowCovering : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -10340,9 +10340,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Barrier Control * */ -@interface MTRBarrierControl : MTRCluster +@interface MTRBaseClusterBarrierControl : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -10662,9 +10662,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Pump Configuration and Control * */ -@interface MTRPumpConfigurationAndControl : MTRCluster +@interface MTRBaseClusterPumpConfigurationAndControl : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -11189,9 +11189,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Thermostat * */ -@interface MTRThermostat : MTRCluster +@interface MTRBaseClusterThermostat : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -12329,9 +12329,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Fan Control * */ -@interface MTRFanControl : MTRCluster +@interface MTRBaseClusterFanControl : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -12649,9 +12649,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Thermostat User Interface Configuration * */ -@interface MTRThermostatUserInterfaceConfiguration : MTRCluster +@interface MTRBaseClusterThermostatUserInterfaceConfiguration : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -12825,9 +12825,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Color Control * */ -@interface MTRColorControl : MTRCluster +@interface MTRBaseClusterColorControl : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -13931,9 +13931,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Illuminance Measurement * */ -@interface MTRIlluminanceMeasurement : MTRCluster +@interface MTRBaseClusterIlluminanceMeasurement : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -14125,9 +14125,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Temperature Measurement * */ -@interface MTRTemperatureMeasurement : MTRCluster +@interface MTRBaseClusterTemperatureMeasurement : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -14301,9 +14301,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Pressure Measurement * */ -@interface MTRPressureMeasurement : MTRCluster +@interface MTRBaseClusterPressureMeasurement : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -14563,9 +14563,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Flow Measurement * */ -@interface MTRFlowMeasurement : MTRCluster +@interface MTRBaseClusterFlowMeasurement : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -14739,9 +14739,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Relative Humidity Measurement * */ -@interface MTRRelativeHumidityMeasurement : MTRCluster +@interface MTRBaseClusterRelativeHumidityMeasurement : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -14915,9 +14915,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Occupancy Sensing * */ -@interface MTROccupancySensing : MTRCluster +@interface MTRBaseClusterOccupancySensing : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -15295,9 +15295,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Wake on LAN * */ -@interface MTRWakeOnLan : MTRCluster +@interface MTRBaseClusterWakeOnLan : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -15418,9 +15418,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Channel * */ -@interface MTRChannel : MTRCluster +@interface MTRBaseClusterChannel : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -15584,9 +15584,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Target Navigator * */ -@interface MTRTargetNavigator : MTRCluster +@interface MTRBaseClusterTargetNavigator : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -15728,9 +15728,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Media Playback * */ -@interface MTRMediaPlayback : MTRCluster +@interface MTRBaseClusterMediaPlayback : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -16006,9 +16006,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Media Input * */ -@interface MTRMediaInput : MTRCluster +@interface MTRBaseClusterMediaInput : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -16155,9 +16155,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Low Power * */ -@interface MTRLowPower : MTRCluster +@interface MTRBaseClusterLowPower : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -16264,9 +16264,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Keypad Input * */ -@interface MTRKeypadInput : MTRCluster +@interface MTRBaseClusterKeypadInput : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -16374,9 +16374,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Content Launcher * */ -@interface MTRContentLauncher : MTRCluster +@interface MTRBaseClusterContentLauncher : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -16528,9 +16528,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Audio Output * */ -@interface MTRAudioOutput : MTRCluster +@interface MTRBaseClusterAudioOutput : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -16673,9 +16673,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Application Launcher * */ -@interface MTRApplicationLauncher : MTRCluster +@interface MTRBaseClusterApplicationLauncher : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -16829,9 +16829,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Application Basic * */ -@interface MTRApplicationBasic : MTRCluster +@interface MTRBaseClusterApplicationBasic : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -17073,9 +17073,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Account Login * */ -@interface MTRAccountLogin : MTRCluster +@interface MTRBaseClusterAccountLogin : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -17187,9 +17187,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Electrical Measurement * */ -@interface MTRElectricalMeasurement : MTRCluster +@interface MTRBaseClusterElectricalMeasurement : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; @@ -19700,9 +19700,9 @@ NS_ASSUME_NONNULL_BEGIN * Cluster Test Cluster * */ -@interface MTRTestCluster : MTRCluster +@interface MTRBaseClusterTestCluster : MTRCluster -- (nullable instancetype)initWithDevice:(MTRDevice *)device +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm similarity index 99% rename from src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.mm rename to src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 518abbae399411..45b77617ef60bc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -20,12 +20,12 @@ #import #import "MTRAttributeCacheContainer_Internal.h" +#import "MTRBaseClusters_internal.h" +#import "MTRBaseDevice.h" +#import "MTRBaseDevice_Internal.h" #import "MTRCallbackBridge_internal.h" #import "MTRCluster_internal.h" -#import "MTRClustersObjc_internal.h" #import "MTRCommandPayloadsObjc.h" -#import "MTRDevice.h" -#import "MTRDevice_Internal.h" #import "MTRStructsObjc.h" #include @@ -36,9 +36,9 @@ using chip::Callback::Cancelable; using namespace chip::app::Clusters; // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. -@implementation MTRIdentify +@implementation MTRBaseClusterIdentify -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -597,9 +597,9 @@ - (void)dealloc @end -@implementation MTRGroups +@implementation MTRBaseClusterGroups -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -1180,9 +1180,9 @@ - (void)dealloc @end -@implementation MTRScenes +@implementation MTRBaseClusterScenes -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -2296,9 +2296,9 @@ - (void)dealloc @end -@implementation MTROnOff +@implementation MTRBaseClusterOnOff -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -3221,9 +3221,9 @@ - (void)dealloc @end -@implementation MTROnOffSwitchConfiguration +@implementation MTRBaseClusterOnOffSwitchConfiguration -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -3730,9 +3730,9 @@ - (void)dealloc @end -@implementation MTRLevelControl +@implementation MTRBaseClusterLevelControl -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -5443,9 +5443,9 @@ - (void)dealloc @end -@implementation MTRBinaryInputBasic +@implementation MTRBaseClusterBinaryInputBasic -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -6536,9 +6536,9 @@ - (void)dealloc @end -@implementation MTRDescriptor +@implementation MTRBaseClusterDescriptor -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -7133,9 +7133,9 @@ - (void)dealloc @end -@implementation MTRBinding +@implementation MTRBaseClusterBinding -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -7616,9 +7616,9 @@ - (void)dealloc @end -@implementation MTRAccessControl +@implementation MTRBaseClusterAccessControl -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -8467,9 +8467,9 @@ - (void)dealloc @end -@implementation MTRBridgedActions +@implementation MTRBaseClusterBridgedActions -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -9370,9 +9370,9 @@ - (void)dealloc @end -@implementation MTRBasic +@implementation MTRBaseClusterBasic -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -11071,9 +11071,9 @@ - (void)dealloc @end -@implementation MTROtaSoftwareUpdateProvider +@implementation MTRBaseClusterOtaSoftwareUpdateProvider -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -11541,9 +11541,9 @@ - (void)dealloc @end -@implementation MTROtaSoftwareUpdateRequestor +@implementation MTRBaseClusterOtaSoftwareUpdateRequestor -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -12245,9 +12245,9 @@ - (void)dealloc @end -@implementation MTRLocalizationConfiguration +@implementation MTRBaseClusterLocalizationConfiguration -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -12757,9 +12757,9 @@ - (void)dealloc @end -@implementation MTRTimeFormatLocalization +@implementation MTRBaseClusterTimeFormatLocalization -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -13366,9 +13366,9 @@ - (void)dealloc @end -@implementation MTRUnitLocalization +@implementation MTRBaseClusterUnitLocalization -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -13815,9 +13815,9 @@ - (void)dealloc @end -@implementation MTRPowerSourceConfiguration +@implementation MTRBaseClusterPowerSourceConfiguration -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -14231,9 +14231,9 @@ - (void)dealloc @end -@implementation MTRPowerSource +@implementation MTRBaseClusterPowerSource -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -16523,9 +16523,9 @@ - (void)dealloc @end -@implementation MTRGeneralCommissioning +@implementation MTRBaseClusterGeneralCommissioning -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -17309,9 +17309,9 @@ - (void)dealloc @end -@implementation MTRNetworkCommissioning +@implementation MTRBaseClusterNetworkCommissioning -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -18373,9 +18373,9 @@ - (void)dealloc @end -@implementation MTRDiagnosticLogs +@implementation MTRBaseClusterDiagnosticLogs -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -18752,9 +18752,9 @@ - (void)dealloc @end -@implementation MTRGeneralDiagnostics +@implementation MTRBaseClusterGeneralDiagnostics -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -19697,9 +19697,9 @@ - (void)dealloc @end -@implementation MTRSoftwareDiagnostics +@implementation MTRBaseClusterSoftwareDiagnostics -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -20329,9 +20329,9 @@ - (void)dealloc @end -@implementation MTRThreadNetworkDiagnostics +@implementation MTRBaseClusterThreadNetworkDiagnostics -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -24652,9 +24652,9 @@ - (void)dealloc @end -@implementation MTRWiFiNetworkDiagnostics +@implementation MTRBaseClusterWiFiNetworkDiagnostics -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -25847,9 +25847,9 @@ - (void)dealloc @end -@implementation MTREthernetNetworkDiagnostics +@implementation MTRBaseClusterEthernetNetworkDiagnostics -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -26789,9 +26789,9 @@ - (void)dealloc @end -@implementation MTRBridgedDeviceBasic +@implementation MTRBaseClusterBridgedDeviceBasic -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -28089,9 +28089,9 @@ - (void)dealloc @end -@implementation MTRSwitch +@implementation MTRBaseClusterSwitch -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -28627,9 +28627,9 @@ - (void)dealloc @end -@implementation MTRAdministratorCommissioning +@implementation MTRBaseClusterAdministratorCommissioning -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -29261,9 +29261,9 @@ - (void)dealloc @end -@implementation MTROperationalCredentials +@implementation MTRBaseClusterOperationalCredentials -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -30196,9 +30196,9 @@ - (void)dealloc @end -@implementation MTRGroupKeyManagement +@implementation MTRBaseClusterGroupKeyManagement -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -31013,9 +31013,9 @@ - (void)dealloc @end -@implementation MTRFixedLabel +@implementation MTRBaseClusterFixedLabel -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -31427,9 +31427,9 @@ - (void)dealloc @end -@implementation MTRUserLabel +@implementation MTRBaseClusterUserLabel -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -31895,9 +31895,9 @@ - (void)dealloc @end -@implementation MTRBooleanState +@implementation MTRBaseClusterBooleanState -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -32308,9 +32308,9 @@ - (void)dealloc @end -@implementation MTRModeSelect +@implementation MTRBaseClusterModeSelect -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -33132,9 +33132,9 @@ - (void)dealloc @end -@implementation MTRDoorLock +@implementation MTRBaseClusterDoorLock -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -36897,9 +36897,9 @@ - (void)dealloc @end -@implementation MTRWindowCovering +@implementation MTRBaseClusterWindowCovering -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -38864,9 +38864,9 @@ - (void)dealloc @end -@implementation MTRBarrierControl +@implementation MTRBaseClusterBarrierControl -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -40094,9 +40094,9 @@ - (void)dealloc @end -@implementation MTRPumpConfigurationAndControl +@implementation MTRBaseClusterPumpConfigurationAndControl -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -42041,9 +42041,9 @@ - (void)dealloc @end -@implementation MTRThermostat +@implementation MTRBaseClusterThermostat -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -46517,9 +46517,9 @@ - (void)dealloc @end -@implementation MTRFanControl +@implementation MTRBaseClusterFanControl -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -47749,9 +47749,9 @@ - (void)dealloc @end -@implementation MTRThermostatUserInterfaceConfiguration +@implementation MTRBaseClusterThermostatUserInterfaceConfiguration -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -48404,9 +48404,9 @@ - (void)dealloc @end -@implementation MTRColorControl +@implementation MTRBaseClusterColorControl -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -52955,9 +52955,9 @@ - (void)dealloc @end -@implementation MTRIlluminanceMeasurement +@implementation MTRBaseClusterIlluminanceMeasurement -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -53620,9 +53620,9 @@ - (void)dealloc @end -@implementation MTRTemperatureMeasurement +@implementation MTRBaseClusterTemperatureMeasurement -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -54222,9 +54222,9 @@ - (void)dealloc @end -@implementation MTRPressureMeasurement +@implementation MTRBaseClusterPressureMeasurement -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -55133,9 +55133,9 @@ - (void)dealloc @end -@implementation MTRFlowMeasurement +@implementation MTRBaseClusterFlowMeasurement -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -55735,9 +55735,9 @@ - (void)dealloc @end -@implementation MTRRelativeHumidityMeasurement +@implementation MTRBaseClusterRelativeHumidityMeasurement -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -56342,9 +56342,9 @@ - (void)dealloc @end -@implementation MTROccupancySensing +@implementation MTRBaseClusterOccupancySensing -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -57766,9 +57766,9 @@ - (void)dealloc @end -@implementation MTRWakeOnLan +@implementation MTRBaseClusterWakeOnLan -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -58179,9 +58179,9 @@ - (void)dealloc @end -@implementation MTRChannel +@implementation MTRBaseClusterChannel -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -58794,9 +58794,9 @@ - (void)dealloc @end -@implementation MTRTargetNavigator +@implementation MTRBaseClusterTargetNavigator -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -59298,9 +59298,9 @@ - (void)dealloc @end -@implementation MTRMediaPlayback +@implementation MTRBaseClusterMediaPlayback -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -60372,9 +60372,9 @@ - (void)dealloc @end -@implementation MTRMediaInput +@implementation MTRBaseClusterMediaInput -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -60956,9 +60956,9 @@ - (void)dealloc @end -@implementation MTRLowPower +@implementation MTRBaseClusterLowPower -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -61337,9 +61337,9 @@ - (void)dealloc @end -@implementation MTRKeypadInput +@implementation MTRBaseClusterKeypadInput -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -61713,9 +61713,9 @@ - (void)dealloc @end -@implementation MTRContentLauncher +@implementation MTRBaseClusterContentLauncher -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -62426,9 +62426,9 @@ - (void)dealloc @end -@implementation MTRAudioOutput +@implementation MTRBaseClusterAudioOutput -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -62956,9 +62956,9 @@ - (void)dealloc @end -@implementation MTRApplicationLauncher +@implementation MTRBaseClusterApplicationLauncher -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -63556,9 +63556,9 @@ - (void)dealloc @end -@implementation MTRApplicationBasic +@implementation MTRBaseClusterApplicationBasic -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -64404,9 +64404,9 @@ - (void)dealloc @end -@implementation MTRAccountLogin +@implementation MTRBaseClusterAccountLogin -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -64844,9 +64844,9 @@ - (void)dealloc @end -@implementation MTRElectricalMeasurement +@implementation MTRBaseClusterElectricalMeasurement -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { @@ -73508,9 +73508,9 @@ - (void)dealloc @end -@implementation MTRTestCluster +@implementation MTRBaseClusterTestCluster -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue +- (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue { if (self = [super initWithQueue:queue]) { if (device == nil) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h new file mode 100644 index 00000000000000..d918ac6284b7ef --- /dev/null +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters_internal.h @@ -0,0 +1,409 @@ +/* + * + * 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 "MTRBaseClusters.h" +#import "MTRBaseDevice.h" + +#include + +@interface MTRBaseClusterIdentify () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::IdentifyCluster * cppCluster; +- (chip::Controller::IdentifyCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterGroups () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::GroupsCluster * cppCluster; +- (chip::Controller::GroupsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterScenes () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ScenesCluster * cppCluster; +- (chip::Controller::ScenesCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterOnOff () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::OnOffCluster * cppCluster; +- (chip::Controller::OnOffCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterOnOffSwitchConfiguration () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::OnOffSwitchConfigurationCluster * cppCluster; +- (chip::Controller::OnOffSwitchConfigurationCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterLevelControl () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::LevelControlCluster * cppCluster; +- (chip::Controller::LevelControlCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterBinaryInputBasic () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::BinaryInputBasicCluster * cppCluster; +- (chip::Controller::BinaryInputBasicCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterDescriptor () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::DescriptorCluster * cppCluster; +- (chip::Controller::DescriptorCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterBinding () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::BindingCluster * cppCluster; +- (chip::Controller::BindingCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterAccessControl () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::AccessControlCluster * cppCluster; +- (chip::Controller::AccessControlCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterBridgedActions () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::BridgedActionsCluster * cppCluster; +- (chip::Controller::BridgedActionsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterBasic () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::BasicCluster * cppCluster; +- (chip::Controller::BasicCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterOtaSoftwareUpdateProvider () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::OtaSoftwareUpdateProviderCluster * cppCluster; +- (chip::Controller::OtaSoftwareUpdateProviderCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterOtaSoftwareUpdateRequestor () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::OtaSoftwareUpdateRequestorCluster * cppCluster; +- (chip::Controller::OtaSoftwareUpdateRequestorCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterLocalizationConfiguration () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::LocalizationConfigurationCluster * cppCluster; +- (chip::Controller::LocalizationConfigurationCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterTimeFormatLocalization () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::TimeFormatLocalizationCluster * cppCluster; +- (chip::Controller::TimeFormatLocalizationCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterUnitLocalization () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::UnitLocalizationCluster * cppCluster; +- (chip::Controller::UnitLocalizationCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterPowerSourceConfiguration () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::PowerSourceConfigurationCluster * cppCluster; +- (chip::Controller::PowerSourceConfigurationCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterPowerSource () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::PowerSourceCluster * cppCluster; +- (chip::Controller::PowerSourceCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterGeneralCommissioning () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::GeneralCommissioningCluster * cppCluster; +- (chip::Controller::GeneralCommissioningCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterNetworkCommissioning () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::NetworkCommissioningCluster * cppCluster; +- (chip::Controller::NetworkCommissioningCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterDiagnosticLogs () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::DiagnosticLogsCluster * cppCluster; +- (chip::Controller::DiagnosticLogsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterGeneralDiagnostics () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::GeneralDiagnosticsCluster * cppCluster; +- (chip::Controller::GeneralDiagnosticsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterSoftwareDiagnostics () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::SoftwareDiagnosticsCluster * cppCluster; +- (chip::Controller::SoftwareDiagnosticsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterThreadNetworkDiagnostics () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ThreadNetworkDiagnosticsCluster * cppCluster; +- (chip::Controller::ThreadNetworkDiagnosticsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterWiFiNetworkDiagnostics () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::WiFiNetworkDiagnosticsCluster * cppCluster; +- (chip::Controller::WiFiNetworkDiagnosticsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterEthernetNetworkDiagnostics () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::EthernetNetworkDiagnosticsCluster * cppCluster; +- (chip::Controller::EthernetNetworkDiagnosticsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterBridgedDeviceBasic () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::BridgedDeviceBasicCluster * cppCluster; +- (chip::Controller::BridgedDeviceBasicCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterSwitch () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::SwitchCluster * cppCluster; +- (chip::Controller::SwitchCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterAdministratorCommissioning () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::AdministratorCommissioningCluster * cppCluster; +- (chip::Controller::AdministratorCommissioningCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterOperationalCredentials () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::OperationalCredentialsCluster * cppCluster; +- (chip::Controller::OperationalCredentialsCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterGroupKeyManagement () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::GroupKeyManagementCluster * cppCluster; +- (chip::Controller::GroupKeyManagementCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterFixedLabel () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::FixedLabelCluster * cppCluster; +- (chip::Controller::FixedLabelCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterUserLabel () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::UserLabelCluster * cppCluster; +- (chip::Controller::UserLabelCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterBooleanState () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::BooleanStateCluster * cppCluster; +- (chip::Controller::BooleanStateCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterModeSelect () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ModeSelectCluster * cppCluster; +- (chip::Controller::ModeSelectCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterDoorLock () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::DoorLockCluster * cppCluster; +- (chip::Controller::DoorLockCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterWindowCovering () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::WindowCoveringCluster * cppCluster; +- (chip::Controller::WindowCoveringCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterBarrierControl () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::BarrierControlCluster * cppCluster; +- (chip::Controller::BarrierControlCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterPumpConfigurationAndControl () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::PumpConfigurationAndControlCluster * cppCluster; +- (chip::Controller::PumpConfigurationAndControlCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterThermostat () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ThermostatCluster * cppCluster; +- (chip::Controller::ThermostatCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterFanControl () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::FanControlCluster * cppCluster; +- (chip::Controller::FanControlCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterThermostatUserInterfaceConfiguration () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ThermostatUserInterfaceConfigurationCluster * cppCluster; +- (chip::Controller::ThermostatUserInterfaceConfigurationCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterColorControl () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ColorControlCluster * cppCluster; +- (chip::Controller::ColorControlCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterIlluminanceMeasurement () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::IlluminanceMeasurementCluster * cppCluster; +- (chip::Controller::IlluminanceMeasurementCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterTemperatureMeasurement () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::TemperatureMeasurementCluster * cppCluster; +- (chip::Controller::TemperatureMeasurementCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterPressureMeasurement () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::PressureMeasurementCluster * cppCluster; +- (chip::Controller::PressureMeasurementCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterFlowMeasurement () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::FlowMeasurementCluster * cppCluster; +- (chip::Controller::FlowMeasurementCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterRelativeHumidityMeasurement () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::RelativeHumidityMeasurementCluster * cppCluster; +- (chip::Controller::RelativeHumidityMeasurementCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterOccupancySensing () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::OccupancySensingCluster * cppCluster; +- (chip::Controller::OccupancySensingCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterWakeOnLan () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::WakeOnLanCluster * cppCluster; +- (chip::Controller::WakeOnLanCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterChannel () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ChannelCluster * cppCluster; +- (chip::Controller::ChannelCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterTargetNavigator () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::TargetNavigatorCluster * cppCluster; +- (chip::Controller::TargetNavigatorCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterMediaPlayback () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::MediaPlaybackCluster * cppCluster; +- (chip::Controller::MediaPlaybackCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterMediaInput () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::MediaInputCluster * cppCluster; +- (chip::Controller::MediaInputCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterLowPower () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::LowPowerCluster * cppCluster; +- (chip::Controller::LowPowerCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterKeypadInput () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::KeypadInputCluster * cppCluster; +- (chip::Controller::KeypadInputCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterContentLauncher () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ContentLauncherCluster * cppCluster; +- (chip::Controller::ContentLauncherCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterAudioOutput () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::AudioOutputCluster * cppCluster; +- (chip::Controller::AudioOutputCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterApplicationLauncher () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ApplicationLauncherCluster * cppCluster; +- (chip::Controller::ApplicationLauncherCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterApplicationBasic () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ApplicationBasicCluster * cppCluster; +- (chip::Controller::ApplicationBasicCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterAccountLogin () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::AccountLoginCluster * cppCluster; +- (chip::Controller::AccountLoginCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterElectricalMeasurement () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::ElectricalMeasurementCluster * cppCluster; +- (chip::Controller::ElectricalMeasurementCluster **)cppClusterSlot; +@end + +@interface MTRBaseClusterTestCluster () +// Must only touch cppCluster on the Matter queue. +@property (readonly) chip::Controller::TestClusterCluster * cppCluster; +- (chip::Controller::TestClusterCluster **)cppClusterSlot; +@end diff --git a/src/darwin/Framework/CHIPTests/MTRClustersTests.m b/src/darwin/Framework/CHIPTests/MTRClustersTests.m index f6aebf6b0e5bb0..8e2931f354f33f 100644 --- a/src/darwin/Framework/CHIPTests/MTRClustersTests.m +++ b/src/darwin/Framework/CHIPTests/MTRClustersTests.m @@ -141,7 +141,7 @@ - (void)testInitStack __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; [controller getDevice:nodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); [connectionExpectation fulfill]; connectionExpectation = nil; @@ -166,11 +166,11 @@ - (void)testReuseChipClusterObject MTRDeviceController * controller = sController; XCTAssertNotNil(controller); - __block MTRDevice * device; + __block MTRBaseDevice * device; __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; [controller getDevice:nodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable retrievedDevice, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable retrievedDevice, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); [connectionExpectation fulfill]; connectionExpectation = nil; diff --git a/src/darwin/Framework/CHIPTests/MTRControllerTests.m b/src/darwin/Framework/CHIPTests/MTRControllerTests.m index 9d3b3e462e5a9a..44d59459d2e04a 100644 --- a/src/darwin/Framework/CHIPTests/MTRControllerTests.m +++ b/src/darwin/Framework/CHIPTests/MTRControllerTests.m @@ -183,7 +183,7 @@ - (void)testControllerInvalidAccess XCTAssertFalse([controller isRunning]); XCTAssertFalse([controller getDevice:1234 queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable chipDevice, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable chipDevice, NSError * _Nullable error) { XCTAssertEqual(error.code, MTRErrorCodeInvalidState); }]); diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 5e781f83cadc06..d8a21081de27ca 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -20,8 +20,8 @@ // module headers #import -#import -#import +#import +#import #import #import "MTRErrorTestUtils.h" @@ -50,7 +50,7 @@ // 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 MTRDevice * mConnectedDevice; +static MTRBaseDevice * mConnectedDevice; // Singleton controller we use. static MTRDeviceController * sController = nil; @@ -62,21 +62,21 @@ static void WaitForCommissionee(XCTestExpectation * expectation, dispatch_queue_ [controller getDevice:kDeviceId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); [expectation fulfill]; mConnectedDevice = device; }]; } -static MTRDevice * GetConnectedDevice(void) +static MTRBaseDevice * GetConnectedDevice(void) { XCTAssertNotNil(mConnectedDevice); return mConnectedDevice; } #ifdef DEBUG -@interface MTRDevice (Test) +@interface MTRBaseDevice (Test) - (void)failSubscribers:(dispatch_queue_t)clientQueue completion:(void (^)(void))completion; @end #endif @@ -179,7 +179,7 @@ - (void)initStack __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; [controller getDevice:kDeviceId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); [connectionExpectation fulfill]; connectionExpectation = nil; @@ -224,7 +224,7 @@ - (void)test001_ReadAttribute XCTestExpectation * expectation = [self expectationWithDescription:@"read DeviceDescriptor DeviceType attribute for all endpoints"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); [device readAttributeWithEndpointId:nil @@ -264,7 +264,7 @@ - (void)test002_WriteAttribute #endif XCTestExpectation * expectation = [self expectationWithDescription:@"write LevelControl Brightness attribute"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); NSDictionary * writeValue = [NSDictionary @@ -307,7 +307,7 @@ - (void)test003_InvokeCommand #endif XCTestExpectation * expectation = [self expectationWithDescription:@"invoke MoveToLevelWithOnOff command"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); NSDictionary * fields = @{ @@ -355,7 +355,7 @@ - (void)test005_Subscribe [self initStack]; [self waitForCommissionee]; #endif - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); // Subscribe @@ -498,7 +498,7 @@ - (void)test006_ReadAttributeFailure #endif XCTestExpectation * expectation = [self expectationWithDescription:@"read failed"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); [device @@ -527,7 +527,7 @@ - (void)test007_WriteAttributeFailure #endif XCTestExpectation * expectation = [self expectationWithDescription:@"write failed"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); NSDictionary * writeValue = [NSDictionary @@ -560,31 +560,33 @@ - (void)test008_InvokeCommandFailure #endif XCTestExpectation * expectation = [self expectationWithDescription:@"invoke MoveToLevelWithOnOff command"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - NSDictionary * fields = @{ - @"type" : @"Structure", - @"value" : @[ - @{ @"contextTag" : @0, @"data" : @ { @"type" : @"UnsignedInteger", @"value" : @0 } }, - @{ @"contextTag" : @1, @"data" : @ { @"type" : @"UnsignedInteger", @"value" : @10 } } + NSDictionary * fields = @ { +@"type" : + @"Structure", +@"value" : + @[ +@{ @"contextTag" : @0, @"data" : @ { @"type" : @"UnsignedInteger", @"value" : @0 } }, +@{ @"contextTag" : @1, @"data" : @ { @"type" : @"UnsignedInteger", @"value" : @10 } } ] }; [device - invokeCommandWithEndpointId:@1 - clusterId:@8 - commandId:@40000 - commandFields:fields - timedInvokeTimeout:nil - clientQueue:queue - completion:^(id _Nullable values, NSError * _Nullable error) { - NSLog(@"invoke command: MoveToLevelWithOnOff values: %@, error: %@", values, error); - - XCTAssertNil(values); - XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:error], EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND); - - [expectation fulfill]; - }]; + invokeCommandWithEndpointId:@1 + clusterId:@8 + commandId:@40000 + commandFields:fields + timedInvokeTimeout:nil + clientQueue:queue + completion:^(id _Nullable values, NSError * _Nullable error) { + NSLog(@"invoke command: MoveToLevelWithOnOff values: %@, error: %@", values, error); + + XCTAssertNil(values); + XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:error], EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND); + + [expectation fulfill]; + }]; [self waitForExpectations:[NSArray arrayWithObject:expectation] timeout:kTimeoutInSeconds]; } @@ -607,7 +609,7 @@ - (void)test009_SubscribeFailure [errorReportExpectation fulfill]; }; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); XCTestExpectation * cleanSubscriptionExpectation = [self expectationWithDescription:@"Previous subscriptions cleaned"]; @@ -653,7 +655,7 @@ - (void)test010_ReadAllAttribute XCTestExpectation * expectation = [self expectationWithDescription:@"read DeviceDescriptor DeviceType attribute for all endpoints"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); [device readAttributeWithEndpointId:@1 @@ -691,7 +693,7 @@ - (void)test011_ReadCachedAttribute [self waitForCommissionee]; #endif - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); XCTestExpectation * cleanSubscriptionExpectation = [self expectationWithDescription:@"Previous subscriptions cleaned"]; NSLog(@"Deregistering report handlers..."); @@ -738,7 +740,7 @@ - (void)test011_ReadCachedAttribute // Invoke command to set the attribute to a known state XCTestExpectation * commandExpectation = [self expectationWithDescription:@"Command invoked"]; - MTROnOff * cluster = [[MTROnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + MTRBaseClusterOnOff * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); NSLog(@"Invoking command..."); @@ -756,15 +758,15 @@ - (void)test011_ReadCachedAttribute // Read cache NSLog(@"Reading from cache..."); XCTestExpectation * cacheExpectation = [self expectationWithDescription:@"Attribute cache read"]; - [MTROnOff readAttributeOnOffWithAttributeCache:attributeCacheContainer - endpoint:@1 - queue:queue - completionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute cache value: %@, error: %@", value, err); - XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:err], 0); - XCTAssertTrue([value isEqualToNumber:[NSNumber numberWithBool:YES]]); - [cacheExpectation fulfill]; - }]; + [MTRBaseClusterOnOff readAttributeOnOffWithAttributeCache:attributeCacheContainer + endpoint:@1 + queue:queue + completionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read attribute cache value: %@, error: %@", value, err); + XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertTrue([value isEqualToNumber:[NSNumber numberWithBool:YES]]); + [cacheExpectation fulfill]; + }]; [self waitForExpectations:[NSArray arrayWithObject:cacheExpectation] timeout:kTimeoutInSeconds]; // Add another subscriber of the attribute to verify that attribute cache still works when there are other subscribers. @@ -944,7 +946,7 @@ - (void)test012_SubscriptionError [self initStack]; [self waitForCommissionee]; #endif - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); XCTestExpectation * deregisterExpectation = [self expectationWithDescription:@"Report handler deregistered"]; [device deregisterReportHandlersWithClientQueue:queue @@ -1052,7 +1054,7 @@ - (void)test900_SubscribeAllAttributes [self initStack]; [self waitForCommissionee]; #endif - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); XCTestExpectation * cleanSubscriptionExpectation = [self expectationWithDescription:@"Previous subscriptions cleaned"]; NSLog(@"Deregistering report handlers..."); @@ -1229,7 +1231,7 @@ - (void)test999_TearDown @end -@interface MTRDevice (Test) +@interface MTRBaseDevice (Test) // Test function for whitebox testing + (id)CHIPEncodeAndDecodeNSObject:(id)object; @end @@ -1243,7 +1245,7 @@ - (void)testSignedInteger { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:-713], @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1254,7 +1256,7 @@ - (void)testSignedInteger64Bits { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"SignedInteger", @"type", [NSNumber numberWithInteger:-0x7000111122223333ll], @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1265,7 +1267,7 @@ - (void)testUnsignedInteger { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", [NSNumber numberWithInteger:1025], @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1276,7 +1278,7 @@ - (void)testUnsignedInteger64Bits { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", [NSNumber numberWithUnsignedLongLong:0xCCCCDDDDEEEEFFFFull], @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1287,7 +1289,7 @@ - (void)testBoolean { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"Boolean", @"type", [NSNumber numberWithBool:YES], @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1297,7 +1299,7 @@ - (void)testBoolean - (void)testUTF8String { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"UTF8String", @"type", @"Hello World", @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1309,7 +1311,7 @@ - (void)testOctetString const uint8_t data[] = { 0x00, 0xF2, 0x63 }; NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"OctetString", @"type", [NSData dataWithBytes:data length:sizeof(data)], @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1320,7 +1322,7 @@ - (void)testFloat { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"Float", @"type", [NSNumber numberWithFloat:0.1245], @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1332,7 +1334,7 @@ - (void)testDouble { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"Double", @"type", [NSNumber numberWithFloat:0.1245], @"value", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1343,7 +1345,7 @@ - (void)testDouble - (void)testNull { NSDictionary * input = [NSDictionary dictionaryWithObjectsAndKeys:@"Null", @"type", nil]; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:input]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:input]; NSLog(@"Conversion input: %@\nOutput: %@", input, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1364,7 +1366,7 @@ - (void)testStructure ]; NSDictionary * inputValue = @{ @"type" : @"Structure", @"value" : inputFields }; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:inputValue]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:inputValue]; NSLog(@"Conversion input: %@\nOutput: %@", inputValue, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); @@ -1379,7 +1381,7 @@ - (void)testArray ]; NSDictionary * inputValue = @{ @"type" : @"Array", @"value" : inputFields }; - id output = [MTRDevice CHIPEncodeAndDecodeNSObject:inputValue]; + id output = [MTRBaseDevice CHIPEncodeAndDecodeNSObject:inputValue]; NSLog(@"Conversion input: %@\nOutput: %@", inputValue, output); XCTAssertNotNil(output); XCTAssertTrue([output isKindOfClass:[NSDictionary class]]); diff --git a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m index 3b3b3bc26ac38a..6fd032cd0214c6 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m @@ -19,7 +19,7 @@ */ // module headers -#import +#import #import #import "MTRErrorTestUtils.h" @@ -172,7 +172,7 @@ - (void)readAttributeWithController:(id)controller if (sharedController) { [sharedController getDevice:nodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSLog(@"Failed to get connected device"); completion(nil, error); @@ -208,7 +208,7 @@ - (void)writeAttributeWithController:(id)controller if (sharedController) { [sharedController getDevice:nodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSLog(@"Failed to get connected device"); completion(nil, error); @@ -245,7 +245,7 @@ - (void)invokeCommandWithController:(id)controller if (sharedController) { [sharedController getDevice:nodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSLog(@"Failed to get connected device"); completion(nil, error); @@ -282,7 +282,7 @@ - (void)subscribeAttributeWithController:(id)controller if (sharedController) { [sharedController getDevice:nodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSLog(@"Failed to get connected device"); establishedHandler(); @@ -332,7 +332,7 @@ - (void)stopReportsWithController:(id _Nullable)controller nodeId:(uint64_t)node if (sharedController) { [sharedController getDevice:nodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSLog(@"Failed to get connected device"); } else { @@ -362,7 +362,7 @@ - (void)subscribeWithController:(id _Nullable)controller [sharedController getDevice:nodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@", nodeId, error); completion(error); @@ -439,11 +439,11 @@ - (void)readAttributeCacheWithController:(id _Nullable)controller // 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 MTRDevice * mConnectedDevice; +static MTRBaseDevice * mConnectedDevice; static MTRDeviceController * mDeviceController; static MTRXPCListenerSample * mSampleListener; -static MTRDevice * GetConnectedDevice(void) +static MTRBaseDevice * GetConnectedDevice(void) { XCTAssertNotNil(mConnectedDevice); return mConnectedDevice; @@ -548,7 +548,7 @@ - (void)initStack __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; [controller getDevice:kDeviceId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); [connectionExpectation fulfill]; connectionExpectation = nil; @@ -591,7 +591,7 @@ - (void)waitForCommissionee }]; [remoteController getDevice:kDeviceId queue:queue - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { mConnectedDevice = device; [expectation fulfill]; }]; @@ -616,7 +616,7 @@ - (void)test001_ReadAttribute XCTestExpectation * expectation = [self expectationWithDescription:@"read DeviceDescriptor DeviceType attribute for all endpoints"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); [device readAttributeWithEndpointId:nil @@ -656,7 +656,7 @@ - (void)test002_WriteAttribute #endif XCTestExpectation * expectation = [self expectationWithDescription:@"write LevelControl Brightness attribute"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); NSDictionary * writeValue = [NSDictionary @@ -699,7 +699,7 @@ - (void)test003_InvokeCommand #endif XCTestExpectation * expectation = [self expectationWithDescription:@"invoke MoveToLevelWithOnOff command"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); NSDictionary * fields = @{ @@ -749,7 +749,7 @@ - (void)test004_Subscribe #endif XCTestExpectation * expectation = [self expectationWithDescription:@"subscribe OnOff attribute"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); [device subscribeAttributeWithEndpointId:@1 @@ -840,7 +840,7 @@ - (void)test005_ReadAttributeFailure #endif XCTestExpectation * expectation = [self expectationWithDescription:@"read failed"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); [device readAttributeWithEndpointId:@0 @@ -871,7 +871,7 @@ - (void)test006_WriteAttributeFailure #endif XCTestExpectation * expectation = [self expectationWithDescription:@"write failed"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); NSDictionary * writeValue = [NSDictionary @@ -906,29 +906,29 @@ - (void)test007_InvokeCommandFailure #endif XCTestExpectation * expectation = [self expectationWithDescription:@"invoke MoveToLevelWithOnOff command"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); NSDictionary *fields = [NSDictionary dictionaryWithObjectsAndKeys: - @"Structure", @"type", - [NSArray arrayWithObjects: - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithUnsignedInteger:0], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys: - @"UnsignedInteger", @"type", - [NSNumber numberWithUnsignedInteger:0], @"value", nil], @"value", nil], - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithUnsignedInteger:1], @"tag", - [NSDictionary dictionaryWithObjectsAndKeys: - @"UnsignedInteger", @"type", - [NSNumber numberWithUnsignedInteger:10], @"value", nil], @"value", nil], - nil], @"value", nil]; + @"Structure", @"type", + [NSArray arrayWithObjects: + [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithUnsignedInteger:0], @"tag", + [NSDictionary dictionaryWithObjectsAndKeys: + @"UnsignedInteger", @"type", + [NSNumber numberWithUnsignedInteger:0], @"value", nil], @"value", nil], + [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithUnsignedInteger:1], @"tag", + [NSDictionary dictionaryWithObjectsAndKeys: + @"UnsignedInteger", @"type", + [NSNumber numberWithUnsignedInteger:10], @"value", nil], @"value", nil], + nil], @"value", nil]; [device invokeCommandWithEndpointId:@1 clusterId:@8 commandId:@40000 commandFields:fields clientQueue:queue - timedInvokeTimeout:nil - completion:^(id _Nullable values, NSError * _Nullable error) { - NSLog(@"invoke command: MoveToLevelWithOnOff values: %@, error: %@", values, error); + timedInvokeTimeout:nil + completion:^(id _Nullable values, NSError * _Nullable error) { + NSLog(@"invoke command: MoveToLevelWithOnOff values: %@, error: %@", values, error); - XCTAssertNil(values); + XCTAssertNil(values); // Error is copied over XPC and hence cannot use MTRErrorTestUtils utility which checks against a local domain string object. XCTAssertTrue([error.domain isEqualToString:MTRInteractionErrorDomain]); XCTAssertEqual(error.code, EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND); @@ -959,7 +959,7 @@ - (void)test008_SubscribeFailure [errorReportExpectation fulfill]; }; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); [device subscribeAttributeWithEndpointId:@10000 @@ -996,7 +996,7 @@ - (void)test009_ReadAttributeWithParams XCTestExpectation * expectation = [self expectationWithDescription:@"read DeviceDescriptor DeviceType attribute for all endpoints"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); MTRReadParams * readParams = [[MTRReadParams alloc] init]; @@ -1036,7 +1036,7 @@ - (void)test010_SubscribeWithNoParams [self initStack]; [self waitForCommissionee]; #endif - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); XCTestExpectation * clearExpectation = [self expectationWithDescription:@"report handlers deregistered"]; @@ -1215,7 +1215,7 @@ - (void)test011_SubscribeWithParams [self initStack]; [self waitForCommissionee]; #endif - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); XCTestExpectation * clearExpectation = [self expectationWithDescription:@"report handlers deregistered"]; @@ -1403,7 +1403,7 @@ - (void)test012_SubscribeKeepingPreviousSubscription [self initStack]; [self waitForCommissionee]; #endif - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); XCTestExpectation * clearExpectation = [self expectationWithDescription:@"report handlers deregistered"]; @@ -1582,7 +1582,7 @@ - (void)test013_TimedWriteAttribute [self initStack]; [self waitForCommissionee]; #endif - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); // Write an initial value @@ -1654,25 +1654,25 @@ - (void)test013_TimedWriteAttribute expectation = [self expectationWithDescription:@"Subscribed"]; __block void (^reportHandler)(id _Nullable values, NSError * _Nullable error); [device subscribeAttributeWithEndpointId:@1 - clusterId:@8 - attributeId:@17 - minInterval:@2 - maxInterval:@10 - params:nil - clientQueue:queue - reportHandler:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"report attribute: Brightness values: %@, error: %@", value, error); - - if (reportHandler) { - __auto_type callback = reportHandler; - callback = nil; - callback(value, error); - } + clusterId:@8 + attributeId:@17 + minInterval:@2 + maxInterval:@10 + params:nil + clientQueue:queue + reportHandler:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"report attribute: Brightness values: %@, error: %@", value, error); + + if (reportHandler) { + __auto_type callback = reportHandler; + callback = nil; + callback(value, error); } - subscriptionEstablished:^{ - NSLog(@"subscribe attribute: Brightness established"); - [expectation fulfill]; - }]; + } + subscriptionEstablished:^ { + NSLog(@"subscribe attribute: Brightness established"); + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; // Setup report expectation @@ -1725,7 +1725,7 @@ - (void)test014_TimedInvokeCommand #endif XCTestExpectation * expectation = [self expectationWithDescription:@"invoke MoveToLevelWithOnOff command"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); NSDictionary * fields = @{ @@ -1774,7 +1774,7 @@ - (void)test900_SubscribeAttributeCache #endif XCTestExpectation * expectation = [self expectationWithDescription:@"subscribe attributes by cache"]; - MTRDevice * device = GetConnectedDevice(); + MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); MTRAttributeCacheContainer * attributeCacheContainer = [[MTRAttributeCacheContainer alloc] init]; diff --git a/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m b/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m index b01535c07ad3bf..2ebdeedec4f6e6 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m @@ -100,7 +100,7 @@ - (void)subscribeWithDeviceController:(MTRDeviceController *)deviceController }; [deviceController getDevice:deviceId queue:workQueue - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@", deviceId, error); completionHandler(error); @@ -365,7 +365,7 @@ - (void)testReadAttributeSuccess [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Reading..."); @@ -427,7 +427,7 @@ - (void)testReadAttributeWithParamsSuccess [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Reading..."); @@ -480,7 +480,7 @@ - (void)testReadAttributeFailure [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Reading..."); @@ -539,7 +539,7 @@ - (void)testWriteAttributeSuccess [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Writing..."); @@ -602,7 +602,7 @@ - (void)testTimedWriteAttributeSuccess [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Writing..."); @@ -658,7 +658,7 @@ - (void)testWriteAttributeFailure [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Writing..."); @@ -718,7 +718,7 @@ - (void)testInvokeCommandSuccess [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Invoking command..."); @@ -781,7 +781,7 @@ - (void)testTimedInvokeCommandSuccess [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Invoking command..."); @@ -840,7 +840,7 @@ - (void)testInvokeCommandFailure [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Invoking command..."); @@ -906,7 +906,7 @@ - (void)testSubscribeAttributeSuccess [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -969,7 +969,7 @@ - (void)testSubscribeAttributeSuccess // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1026,7 +1026,7 @@ - (void)testSubscribeAttributeWithParamsSuccess [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -1089,7 +1089,7 @@ - (void)testSubscribeAttributeWithParamsSuccess // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1141,7 +1141,7 @@ - (void)testBadlyFormattedReport [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -1202,7 +1202,7 @@ - (void)testBadlyFormattedReport _xpcDisconnectExpectation.inverted = NO; [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1255,7 +1255,7 @@ - (void)testReportWithUnrelatedEndpointId [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -1318,7 +1318,7 @@ - (void)testReportWithUnrelatedEndpointId // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1371,7 +1371,7 @@ - (void)testReportWithUnrelatedClusterId [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -1434,7 +1434,7 @@ - (void)testReportWithUnrelatedClusterId // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1487,7 +1487,7 @@ - (void)testReportWithUnrelatedAttributeId [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -1550,7 +1550,7 @@ - (void)testReportWithUnrelatedAttributeId // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1603,7 +1603,7 @@ - (void)testReportWithUnrelatedNode [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -1666,7 +1666,7 @@ - (void)testReportWithUnrelatedNode // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1718,7 +1718,7 @@ - (void)testSubscribeMultiEndpoints [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -1781,7 +1781,7 @@ - (void)testSubscribeMultiEndpoints // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1833,7 +1833,7 @@ - (void)testSubscribeMultiClusters [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -1896,7 +1896,7 @@ - (void)testSubscribeMultiClusters // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -1948,7 +1948,7 @@ - (void)testSubscribeMultiAttributes [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -2011,7 +2011,7 @@ - (void)testSubscribeMultiAttributes // Deregister report handler [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -2074,7 +2074,7 @@ - (void)testMutiSubscriptions [_remoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Subscribing..."); @@ -2148,7 +2148,7 @@ - (void)testMutiSubscriptions __auto_type deregisterExpectation = [self expectationWithDescription:@"First subscriber deregistered"]; [_remoteDeviceController getDevice:nodeToStop queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -2206,7 +2206,7 @@ - (void)testMutiSubscriptions __auto_type secondDeregisterExpectation = [self expectationWithDescription:@"Second subscriber deregistered"]; [_remoteDeviceController getDevice:nodeToStop queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:^{ @@ -2276,7 +2276,7 @@ - (void)testAnySharedRemoteController __auto_type deviceAcquired = [self expectationWithDescription:@"Connected device was acquired"]; [unspecifiedRemoteDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); [deviceAcquired fulfill]; @@ -2536,7 +2536,7 @@ - (void)testXPCConnectionFailure [failingDeviceController getDevice:myNodeId queue:dispatch_get_main_queue() - completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) { + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); XCTAssertNil(error); NSLog(@"Device acquired. Reading..."); diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 305a9f857e9937..688e7fa03bb1fc 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -10,8 +10,8 @@ 1E85730C265519AE0050A4D9 /* callback-stub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E857307265519AE0050A4D9 /* callback-stub.cpp */; }; 1EB41B7B263C4CC60048E4C1 /* MTRClustersTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EB41B7A263C4CC60048E4C1 /* MTRClustersTests.m */; }; 1EC3238D271999E2002A8BF0 /* cluster-objects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EC3238C271999E2002A8BF0 /* cluster-objects.cpp */; }; - 1EC4CE5D25CC26E900D7304F /* MTRClustersObjc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1EC4CE5925CC26E900D7304F /* MTRClustersObjc.mm */; }; - 1EC4CE6425CC276600D7304F /* MTRClustersObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EC4CE6325CC276600D7304F /* MTRClustersObjc.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1EC4CE5D25CC26E900D7304F /* MTRBaseClusters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1EC4CE5925CC26E900D7304F /* MTRBaseClusters.mm */; }; + 1EC4CE6425CC276600D7304F /* MTRBaseClusters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EC4CE6325CC276600D7304F /* MTRBaseClusters.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1ED276E026C57CF000547A89 /* MTRCallbackBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1ED276DF26C57CF000547A89 /* MTRCallbackBridge.mm */; }; 1ED276E226C5812A00547A89 /* MTRCluster.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1ED276E126C5812A00547A89 /* MTRCluster.mm */; }; 1ED276E426C5832500547A89 /* MTRCluster.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ED276E326C5832500547A89 /* MTRCluster.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -19,9 +19,9 @@ 27A53C1827FBC6920053F131 /* MTRAttestationTrustStoreBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 27A53C1627FBC6920053F131 /* MTRAttestationTrustStoreBridge.mm */; }; 2C1B027A2641DB4E00780EF1 /* MTROperationalCredentialsDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2C1B02782641DB4E00780EF1 /* MTROperationalCredentialsDelegate.mm */; }; 2C1B027B2641DB4E00780EF1 /* MTROperationalCredentialsDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C1B02792641DB4E00780EF1 /* MTROperationalCredentialsDelegate.h */; }; - 2C222AD0255C620600E446B9 /* MTRDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C222ACE255C620600E446B9 /* MTRDevice.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2C222AD1255C620600E446B9 /* MTRDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2C222ACF255C620600E446B9 /* MTRDevice.mm */; }; - 2C222ADF255C811800E446B9 /* MTRDevice_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C222ADE255C811800E446B9 /* MTRDevice_Internal.h */; }; + 2C222AD0255C620600E446B9 /* MTRBaseDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C222ACE255C620600E446B9 /* MTRBaseDevice.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2C222AD1255C620600E446B9 /* MTRBaseDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2C222ACF255C620600E446B9 /* MTRBaseDevice.mm */; }; + 2C222ADF255C811800E446B9 /* MTRBaseDevice_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C222ADE255C811800E446B9 /* MTRBaseDevice_Internal.h */; }; 2C4DF09E248B2C60009307CB /* libmbedtls.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C4DF09D248B2C60009307CB /* libmbedtls.a */; settings = {ATTRIBUTES = (Required, ); }; }; 2C5EEEF6268A85C400CAE3D3 /* MTRDeviceConnectionBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C5EEEF4268A85C400CAE3D3 /* MTRDeviceConnectionBridge.h */; }; 2C5EEEF7268A85C400CAE3D3 /* MTRDeviceConnectionBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2C5EEEF5268A85C400CAE3D3 /* MTRDeviceConnectionBridge.mm */; }; @@ -76,6 +76,7 @@ 5AE6D4E427A99041001F2493 /* MTRDeviceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AE6D4E327A99041001F2493 /* MTRDeviceTests.m */; }; 754F3DF427FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 754F3DF327FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h */; }; 7560FD1C27FBBD3F005E85B3 /* MTREventTLVValueDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7560FD1B27FBBD3F005E85B3 /* MTREventTLVValueDecoder.mm */; }; + 7596A83E28751220004DAE0E /* MTRBaseClusters_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7596A83D28751220004DAE0E /* MTRBaseClusters_internal.h */; }; 88EBF8CE27FABDD500686BC1 /* MTRDeviceAttestationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EBF8CB27FABDD500686BC1 /* MTRDeviceAttestationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 88EBF8CF27FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 88EBF8CC27FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.mm */; }; 88EBF8D027FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EBF8CD27FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.h */; }; @@ -125,8 +126,8 @@ 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 /* MTRClustersTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRClustersTests.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 = ""; }; - 1EC4CE5925CC26E900D7304F /* MTRClustersObjc.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MTRClustersObjc.mm; path = "zap-generated/MTRClustersObjc.mm"; sourceTree = ""; }; - 1EC4CE6325CC276600D7304F /* MTRClustersObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTRClustersObjc.h; path = "zap-generated/MTRClustersObjc.h"; sourceTree = ""; }; + 1EC4CE5925CC26E900D7304F /* MTRBaseClusters.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MTRBaseClusters.mm; path = "zap-generated/MTRBaseClusters.mm"; sourceTree = ""; }; + 1EC4CE6325CC276600D7304F /* MTRBaseClusters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTRBaseClusters.h; path = "zap-generated/MTRBaseClusters.h"; sourceTree = ""; }; 1ED276DF26C57CF000547A89 /* MTRCallbackBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MTRCallbackBridge.mm; path = "zap-generated/MTRCallbackBridge.mm"; sourceTree = ""; }; 1ED276E126C5812A00547A89 /* MTRCluster.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRCluster.mm; sourceTree = ""; }; 1ED276E326C5832500547A89 /* MTRCluster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRCluster.h; sourceTree = ""; }; @@ -134,9 +135,9 @@ 27A53C1627FBC6920053F131 /* MTRAttestationTrustStoreBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRAttestationTrustStoreBridge.mm; sourceTree = ""; }; 2C1B02782641DB4E00780EF1 /* MTROperationalCredentialsDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTROperationalCredentialsDelegate.mm; sourceTree = ""; }; 2C1B02792641DB4E00780EF1 /* MTROperationalCredentialsDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTROperationalCredentialsDelegate.h; sourceTree = ""; }; - 2C222ACE255C620600E446B9 /* MTRDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDevice.h; sourceTree = ""; }; - 2C222ACF255C620600E446B9 /* MTRDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDevice.mm; sourceTree = ""; }; - 2C222ADE255C811800E446B9 /* MTRDevice_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDevice_Internal.h; sourceTree = ""; }; + 2C222ACE255C620600E446B9 /* MTRBaseDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRBaseDevice.h; sourceTree = ""; }; + 2C222ACF255C620600E446B9 /* MTRBaseDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRBaseDevice.mm; sourceTree = ""; }; + 2C222ADE255C811800E446B9 /* MTRBaseDevice_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRBaseDevice_Internal.h; sourceTree = ""; }; 2C4DF09D248B2C60009307CB /* libmbedtls.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedtls.a; path = lib/libmbedtls.a; sourceTree = BUILT_PRODUCTS_DIR; }; 2C5EEEF4268A85C400CAE3D3 /* MTRDeviceConnectionBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceConnectionBridge.h; sourceTree = ""; }; 2C5EEEF5268A85C400CAE3D3 /* MTRDeviceConnectionBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceConnectionBridge.mm; sourceTree = ""; }; @@ -191,6 +192,7 @@ 5AE6D4E327A99041001F2493 /* MTRDeviceTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTRDeviceTests.m; sourceTree = ""; }; 754F3DF327FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTREventTLVValueDecoder_Internal.h; sourceTree = ""; }; 7560FD1B27FBBD3F005E85B3 /* MTREventTLVValueDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MTREventTLVValueDecoder.mm; path = "zap-generated/MTREventTLVValueDecoder.mm"; sourceTree = ""; }; + 7596A83D28751220004DAE0E /* MTRBaseClusters_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTRBaseClusters_internal.h; path = "zap-generated/MTRBaseClusters_internal.h"; sourceTree = ""; }; 88EBF8CB27FABDD500686BC1 /* MTRDeviceAttestationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceAttestationDelegate.h; sourceTree = ""; }; 88EBF8CC27FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceAttestationDelegateBridge.mm; sourceTree = ""; }; 88EBF8CD27FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceAttestationDelegateBridge.h; sourceTree = ""; }; @@ -275,8 +277,9 @@ 1EC3238C271999E2002A8BF0 /* cluster-objects.cpp */, 1ED276DF26C57CF000547A89 /* MTRCallbackBridge.mm */, 1E857307265519AE0050A4D9 /* callback-stub.cpp */, - 1EC4CE6325CC276600D7304F /* MTRClustersObjc.h */, - 1EC4CE5925CC26E900D7304F /* MTRClustersObjc.mm */, + 1EC4CE6325CC276600D7304F /* MTRBaseClusters.h */, + 1EC4CE5925CC26E900D7304F /* MTRBaseClusters.mm */, + 7596A83D28751220004DAE0E /* MTRBaseClusters_internal.h */, D4772A45285AE98300383630 /* MTRClusterConstants.h */, ); name = CHIPGeneratedFiles; @@ -323,9 +326,9 @@ 2C1B02792641DB4E00780EF1 /* MTROperationalCredentialsDelegate.h */, 2C1B02782641DB4E00780EF1 /* MTROperationalCredentialsDelegate.mm */, 1EC4CE5825CC26AB00D7304F /* CHIPGeneratedFiles */, - 2C222ADE255C811800E446B9 /* MTRDevice_Internal.h */, - 2C222ACE255C620600E446B9 /* MTRDevice.h */, - 2C222ACF255C620600E446B9 /* MTRDevice.mm */, + 2C222ADE255C811800E446B9 /* MTRBaseDevice_Internal.h */, + 2C222ACE255C620600E446B9 /* MTRBaseDevice.h */, + 2C222ACF255C620600E446B9 /* MTRBaseDevice.mm */, 2C8C8FBE253E0C2100797F05 /* MTRPersistentStorageDelegate.h */, 5ACDDD7927CD129700EFD68A /* MTRAttributeCacheContainer.h */, 5A60370727EA1FF60020DB79 /* MTRAttributeCacheContainer+XPC.h */, @@ -442,13 +445,14 @@ 513DDB862761F69300DAA01A /* MTRAttributeTLVValueDecoder_Internal.h in Headers */, 2CB7163F252F731E0026E2BB /* MTRDevicePairingDelegate.h in Headers */, 88EBF8CE27FABDD500686BC1 /* MTRDeviceAttestationDelegate.h in Headers */, - 2C222AD0255C620600E446B9 /* MTRDevice.h in Headers */, + 2C222AD0255C620600E446B9 /* MTRBaseDevice.h in Headers */, 991DC0842475F45400C13860 /* MTRDeviceController.h in Headers */, AF1CB86E2874B03B00865A96 /* MTROTAProviderDelegate.h in Headers */, 754F3DF427FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h in Headers */, B2E0D7B2245B0B5C003C5B48 /* MTRManualSetupPayloadParser.h in Headers */, B2E0D7B1245B0B5C003C5B48 /* Matter.h in Headers */, B2E0D7B8245B0B5C003C5B48 /* MTRSetupPayload.h in Headers */, + 7596A83E28751220004DAE0E /* MTRBaseClusters_internal.h in Headers */, 997DED182695344800975E97 /* MTRThreadOperationalDataset.h in Headers */, 9956064426420367000C28DE /* MTRSetupPayload_Internal.h in Headers */, 27A53C1727FBC6920053F131 /* MTRAttestationTrustStoreBridge.h in Headers */, @@ -464,12 +468,12 @@ 2C8C8FC1253E0C2100797F05 /* MTRPersistentStorageDelegate.h in Headers */, AF1CB8702874B04C00865A96 /* MTROTAProviderDelegateBridge.h in Headers */, B2E0D7B5245B0B5C003C5B48 /* MTRQRCodeSetupPayloadParser.h in Headers */, - 1EC4CE6425CC276600D7304F /* MTRClustersObjc.h in Headers */, + 1EC4CE6425CC276600D7304F /* MTRBaseClusters.h in Headers */, 2C5EEEF6268A85C400CAE3D3 /* MTRDeviceConnectionBridge.h in Headers */, 2C8C8FC0253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.h in Headers */, 51E51FC0282AD37A00FC978D /* MTRDeviceControllerStartupParams_Internal.h in Headers */, 998F286F26D55EC5001846C6 /* MTRP256KeypairBridge.h in Headers */, - 2C222ADF255C811800E446B9 /* MTRDevice_Internal.h in Headers */, + 2C222ADF255C811800E446B9 /* MTRBaseDevice_Internal.h in Headers */, 51E0310027EA20D20083DC9C /* MTRControllerAccessControl.h in Headers */, 991DC08B247704DC00C13860 /* MTRLogging.h in Headers */, 5A7947E527C0129F00434CF2 /* MTRDeviceController+XPC.h in Headers */, @@ -608,11 +612,11 @@ 51B22C2A2740CB47008D5055 /* MTRCommandPayloadsObjc.mm in Sources */, 2C5EEEF7268A85C400CAE3D3 /* MTRDeviceConnectionBridge.mm in Sources */, 51B22C262740CB32008D5055 /* MTRStructsObjc.mm in Sources */, - 2C222AD1255C620600E446B9 /* MTRDevice.mm in Sources */, + 2C222AD1255C620600E446B9 /* MTRBaseDevice.mm in Sources */, 1EC3238D271999E2002A8BF0 /* cluster-objects.cpp in Sources */, 991DC0892475F47D00C13860 /* MTRDeviceController.mm in Sources */, B2E0D7B7245B0B5C003C5B48 /* MTRQRCodeSetupPayloadParser.mm in Sources */, - 1EC4CE5D25CC26E900D7304F /* MTRClustersObjc.mm in Sources */, + 1EC4CE5D25CC26E900D7304F /* MTRBaseClusters.mm in Sources */, 51E0310127EA20D20083DC9C /* MTRControllerAccessControl.mm in Sources */, 1ED276E226C5812A00547A89 /* MTRCluster.mm in Sources */, B2E0D7B3245B0B5C003C5B48 /* MTRError.mm in Sources */, From cb6f46a01990ca42712c5ae6535f66cbc4e8318a Mon Sep 17 00:00:00 2001 From: Jeff Tung Date: Wed, 6 Jul 2022 13:15:24 -0700 Subject: [PATCH 2/5] Fixed CHIPTests --- .../Framework/CHIPTests/MTRClustersTests.m | 2 +- .../Framework/CHIPTests/MTRDeviceTests.m | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/darwin/Framework/CHIPTests/MTRClustersTests.m b/src/darwin/Framework/CHIPTests/MTRClustersTests.m index 8e2931f354f33f..a2f399707e87ff 100644 --- a/src/darwin/Framework/CHIPTests/MTRClustersTests.m +++ b/src/darwin/Framework/CHIPTests/MTRClustersTests.m @@ -181,7 +181,7 @@ - (void)testReuseChipClusterObject XCTestExpectation * expectation = [self expectationWithDescription:@"ReuseMTRClusterObjectFirstCall"]; dispatch_queue_t queue = dispatch_get_main_queue(); - MTRTestCluster * cluster = [[MTRTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + MTRBaseClusterTestCluster * cluster = [[MTRBaseClusterTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); [cluster testWithCompletionHandler:^(NSError * err) { diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index d8a21081de27ca..35f75a5ea73f9f 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -823,15 +823,15 @@ - (void)test011_ReadCachedAttribute // Read cache NSLog(@"Reading from cache..."); cacheExpectation = [self expectationWithDescription:@"Attribute cache read"]; - [MTROnOff readAttributeOnOffWithAttributeCache:attributeCacheContainer - endpoint:@1 - queue:queue - completionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read attribute cache value: %@, error: %@", value, err); - XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:err], 0); - XCTAssertTrue([value isEqualToNumber:[NSNumber numberWithBool:NO]]); - [cacheExpectation fulfill]; - }]; + [MTRBaseClusterOnOff readAttributeOnOffWithAttributeCache:attributeCacheContainer + endpoint:@1 + queue:queue + completionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read attribute cache value: %@, error: %@", value, err); + XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertTrue([value isEqualToNumber:[NSNumber numberWithBool:NO]]); + [cacheExpectation fulfill]; + }]; [self waitForExpectations:[NSArray arrayWithObject:cacheExpectation] timeout:kTimeoutInSeconds]; // Read from cache using generic path From 4dc3fcdbe0966bf9e4aaf67be3882c48ae96ec40 Mon Sep 17 00:00:00 2001 From: Jeff Tung Date: Wed, 6 Jul 2022 13:53:45 -0700 Subject: [PATCH 3/5] MTRDEviceController -getDevice:... => -getBaseDevice:... --- src/darwin/Framework/CHIP/MTRDeviceController.h | 4 +++- src/darwin/Framework/CHIP/MTRDeviceController.mm | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index 13988df7f67a9c..61db4061896d10 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -93,7 +93,9 @@ typedef void (^MTRDeviceConnectionCallback)(MTRBaseDevice * _Nullable device, NS - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *)error; - (nullable MTRBaseDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error; -- (BOOL)getDevice:(uint64_t)deviceID queue:(dispatch_queue_t)queue completionHandler:(MTRDeviceConnectionCallback)completionHandler; +- (BOOL)getBaseDevice:(uint64_t)deviceID + queue:(dispatch_queue_t)queue + completionHandler:(MTRDeviceConnectionCallback)completionHandler; - (BOOL)openPairingWindow:(uint64_t)deviceID duration:(NSUInteger)duration error:(NSError * __autoreleasing *)error; - (nullable NSString *)openPairingWindowWithPIN:(uint64_t)deviceID diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index a123b251f00dd5..987166a6fc4abf 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -517,7 +517,9 @@ - (MTRBaseDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError return [[MTRBaseDevice alloc] initWithDevice:deviceProxy]; } -- (BOOL)getDevice:(uint64_t)deviceID queue:(dispatch_queue_t)queue completionHandler:(MTRDeviceConnectionCallback)completionHandler +- (BOOL)getBaseDevice:(uint64_t)deviceID + queue:(dispatch_queue_t)queue + completionHandler:(MTRDeviceConnectionCallback)completionHandler { __block CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE; if (![self isRunning]) { From 6a63b11ad11a73a9f1f6885728c324ca87ce2678 Mon Sep 17 00:00:00 2001 From: Jeff Tung Date: Wed, 6 Jul 2022 16:56:56 -0700 Subject: [PATCH 4/5] Fixed tests for getBaseDevice --- .../Framework Helpers/DefaultsUtils.m | 4 +- .../CHIP/MTRDeviceControllerOverXPC.m | 2 +- .../Framework/CHIPTests/MTRClustersTests.m | 4 +- .../Framework/CHIPTests/MTRControllerTests.m | 2 +- .../Framework/CHIPTests/MTRDeviceTests.m | 4 +- .../CHIPTests/MTRXPCListenerSampleTests.m | 16 ++--- .../Framework/CHIPTests/MTRXPCProtocolTests.m | 70 +++++++++---------- 7 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m index 31229d8a47eb35..3440a251b98bbe 100644 --- a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m +++ b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m @@ -135,7 +135,7 @@ BOOL MTRGetConnectedDevice(MTRDeviceConnectionCallback completionHandler) // Let's use the last device that was paired uint64_t deviceId = MTRGetLastPairedDeviceId(); - return [controller getDevice:deviceId queue:dispatch_get_main_queue() completionHandler:completionHandler]; + return [controller getBaseDevice:deviceId queue:dispatch_get_main_queue() completionHandler:completionHandler]; } MTRBaseDevice * MTRGetDeviceBeingCommissioned(void) @@ -154,7 +154,7 @@ BOOL MTRGetConnectedDeviceWithID(uint64_t deviceId, MTRDeviceConnectionCallback { MTRDeviceController * controller = InitializeMTR(); - return [controller getDevice:deviceId queue:dispatch_get_main_queue() completionHandler:completionHandler]; + return [controller getBaseDevice:deviceId queue:dispatch_get_main_queue() completionHandler:completionHandler]; } BOOL MTRIsDevicePaired(uint64_t deviceId) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m index f0c8c68afc9f51..f9919655357507 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m @@ -97,7 +97,7 @@ - (nullable MTRBaseDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error: return nil; } -- (BOOL)getDevice:(uint64_t)deviceID queue:(dispatch_queue_t)queue completionHandler:(MTRDeviceConnectionCallback)completionHandler +- (BOOL)getBaseDevice:(uint64_t)deviceID queue:(dispatch_queue_t)queue completionHandler:(MTRDeviceConnectionCallback)completionHandler { dispatch_async(_workQueue, ^{ dispatch_group_t group = dispatch_group_create(); diff --git a/src/darwin/Framework/CHIPTests/MTRClustersTests.m b/src/darwin/Framework/CHIPTests/MTRClustersTests.m index a2f399707e87ff..481a19637ce66e 100644 --- a/src/darwin/Framework/CHIPTests/MTRClustersTests.m +++ b/src/darwin/Framework/CHIPTests/MTRClustersTests.m @@ -139,7 +139,7 @@ - (void)testInitStack [self waitForExpectationsWithTimeout:kPairingTimeoutInSeconds handler:nil]; __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; - [controller getDevice:nodeId + [controller getBaseDevice:nodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); @@ -168,7 +168,7 @@ - (void)testReuseChipClusterObject __block MTRBaseDevice * device; __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; - [controller getDevice:nodeId + [controller getBaseDevice:nodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable retrievedDevice, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); diff --git a/src/darwin/Framework/CHIPTests/MTRControllerTests.m b/src/darwin/Framework/CHIPTests/MTRControllerTests.m index 44d59459d2e04a..bf4e344ee98031 100644 --- a/src/darwin/Framework/CHIPTests/MTRControllerTests.m +++ b/src/darwin/Framework/CHIPTests/MTRControllerTests.m @@ -181,7 +181,7 @@ - (void)testControllerInvalidAccess [controller shutdown]; XCTAssertFalse([controller isRunning]); - XCTAssertFalse([controller getDevice:1234 + XCTAssertFalse([controller getBaseDevice:1234 queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable chipDevice, NSError * _Nullable error) { XCTAssertEqual(error.code, MTRErrorCodeInvalidState); diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 35f75a5ea73f9f..8e485ce1fc7848 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -60,7 +60,7 @@ static void WaitForCommissionee(XCTestExpectation * expectation, dispatch_queue_ MTRDeviceController * controller = sController; XCTAssertNotNil(controller); - [controller getDevice:kDeviceId + [controller getBaseDevice:kDeviceId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); @@ -177,7 +177,7 @@ - (void)initStack [self waitForExpectationsWithTimeout:kPairingTimeoutInSeconds handler:nil]; __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; - [controller getDevice:kDeviceId + [controller getBaseDevice:kDeviceId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); diff --git a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m index 6fd032cd0214c6..f50d84d872ddec 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m @@ -170,7 +170,7 @@ - (void)readAttributeWithController:(id)controller (void) controller; __auto_type sharedController = sController; if (sharedController) { - [sharedController getDevice:nodeId + [sharedController getBaseDevice:nodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { @@ -206,7 +206,7 @@ - (void)writeAttributeWithController:(id)controller (void) controller; __auto_type sharedController = sController; if (sharedController) { - [sharedController getDevice:nodeId + [sharedController getBaseDevice:nodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { @@ -243,7 +243,7 @@ - (void)invokeCommandWithController:(id)controller (void) controller; __auto_type sharedController = sController; if (sharedController) { - [sharedController getDevice:nodeId + [sharedController getBaseDevice:nodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { @@ -280,7 +280,7 @@ - (void)subscribeAttributeWithController:(id)controller { __auto_type sharedController = sController; if (sharedController) { - [sharedController getDevice:nodeId + [sharedController getBaseDevice:nodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { @@ -330,7 +330,7 @@ - (void)stopReportsWithController:(id _Nullable)controller nodeId:(uint64_t)node { __auto_type sharedController = sController; if (sharedController) { - [sharedController getDevice:nodeId + [sharedController getBaseDevice:nodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { @@ -360,7 +360,7 @@ - (void)subscribeWithController:(id _Nullable)controller attributeCacheContainer = [[MTRAttributeCacheContainer alloc] init]; } - [sharedController getDevice:nodeId + [sharedController getBaseDevice:nodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { @@ -546,7 +546,7 @@ - (void)initStack [self waitForExpectationsWithTimeout:kPairingTimeoutInSeconds handler:nil]; __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; - [controller getDevice:kDeviceId + [controller getBaseDevice:kDeviceId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertEqual(error.code, 0); @@ -589,7 +589,7 @@ - (void)waitForCommissionee NSLog(@"Listener is not active"); return nil; }]; - [remoteController getDevice:kDeviceId + [remoteController getBaseDevice:kDeviceId queue:queue completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { mConnectedDevice = device; diff --git a/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m b/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m index 2ebdeedec4f6e6..80a6409a83ecc0 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m @@ -98,7 +98,7 @@ - (void)subscribeWithDeviceController:(MTRDeviceController *)deviceController completion(error); }); }; - [deviceController getDevice:deviceId + [deviceController getBaseDevice:deviceId queue:workQueue completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { if (error) { @@ -363,7 +363,7 @@ - (void)testReadAttributeSuccess completion([MTRDeviceController encodeXPCResponseValues:myValues], nil); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -425,7 +425,7 @@ - (void)testReadAttributeWithParamsSuccess completion([MTRDeviceController encodeXPCResponseValues:myValues], nil); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -478,7 +478,7 @@ - (void)testReadAttributeFailure completion(nil, myError); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -537,7 +537,7 @@ - (void)testWriteAttributeSuccess completion([MTRDeviceController encodeXPCResponseValues:myResults], nil); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -600,7 +600,7 @@ - (void)testTimedWriteAttributeSuccess completion([MTRDeviceController encodeXPCResponseValues:myResults], nil); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -656,7 +656,7 @@ - (void)testWriteAttributeFailure completion(nil, myError); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -716,7 +716,7 @@ - (void)testInvokeCommandSuccess completion([MTRDeviceController encodeXPCResponseValues:myResults], nil); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -779,7 +779,7 @@ - (void)testTimedInvokeCommandSuccess completion([MTRDeviceController encodeXPCResponseValues:myResults], nil); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -838,7 +838,7 @@ - (void)testInvokeCommandFailure completion(nil, myError); }; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -904,7 +904,7 @@ - (void)testSubscribeAttributeSuccess _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -967,7 +967,7 @@ - (void)testSubscribeAttributeSuccess }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1024,7 +1024,7 @@ - (void)testSubscribeAttributeWithParamsSuccess _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1087,7 +1087,7 @@ - (void)testSubscribeAttributeWithParamsSuccess }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1139,7 +1139,7 @@ - (void)testBadlyFormattedReport _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1200,7 +1200,7 @@ - (void)testBadlyFormattedReport // Deregister report handler _xpcDisconnectExpectation.inverted = NO; - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1253,7 +1253,7 @@ - (void)testReportWithUnrelatedEndpointId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1316,7 +1316,7 @@ - (void)testReportWithUnrelatedEndpointId }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1369,7 +1369,7 @@ - (void)testReportWithUnrelatedClusterId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1432,7 +1432,7 @@ - (void)testReportWithUnrelatedClusterId }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1485,7 +1485,7 @@ - (void)testReportWithUnrelatedAttributeId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1548,7 +1548,7 @@ - (void)testReportWithUnrelatedAttributeId }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1601,7 +1601,7 @@ - (void)testReportWithUnrelatedNode _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1664,7 +1664,7 @@ - (void)testReportWithUnrelatedNode }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1716,7 +1716,7 @@ - (void)testSubscribeMultiEndpoints _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1779,7 +1779,7 @@ - (void)testSubscribeMultiEndpoints }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1831,7 +1831,7 @@ - (void)testSubscribeMultiClusters _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1894,7 +1894,7 @@ - (void)testSubscribeMultiClusters }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -1946,7 +1946,7 @@ - (void)testSubscribeMultiAttributes _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -2009,7 +2009,7 @@ - (void)testSubscribeMultiAttributes }; // Deregister report handler - [_remoteDeviceController getDevice:myNodeId + [_remoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -2072,7 +2072,7 @@ - (void)testMutiSubscriptions callExpectation = [self expectationWithDescription:[NSString stringWithFormat:@"XPC call (%d) received", i]]; establishExpectation = [self expectationWithDescription:[NSString stringWithFormat:@"Established (%d) called", i]]; [_remoteDeviceController - getDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -2146,7 +2146,7 @@ - (void)testMutiSubscriptions // Deregister report handler for first subscriber __auto_type deregisterExpectation = [self expectationWithDescription:@"First subscriber deregistered"]; - [_remoteDeviceController getDevice:nodeToStop + [_remoteDeviceController getBaseDevice:nodeToStop queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -2204,7 +2204,7 @@ - (void)testMutiSubscriptions // Deregister report handler for second subscriber __auto_type secondDeregisterExpectation = [self expectationWithDescription:@"Second subscriber deregistered"]; - [_remoteDeviceController getDevice:nodeToStop + [_remoteDeviceController getBaseDevice:nodeToStop queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { NSLog(@"Device acquired. Deregistering..."); @@ -2274,7 +2274,7 @@ - (void)testAnySharedRemoteController }; __auto_type deviceAcquired = [self expectationWithDescription:@"Connected device was acquired"]; - [unspecifiedRemoteDeviceController getDevice:myNodeId + [unspecifiedRemoteDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -2534,7 +2534,7 @@ - (void)testXPCConnectionFailure return nil; }]; - [failingDeviceController getDevice:myNodeId + [failingDeviceController getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); From d4e74a9f27f87f9b1db0a53a541a0689768645f6 Mon Sep 17 00:00:00 2001 From: Jeff Tung Date: Wed, 6 Jul 2022 17:27:15 -0700 Subject: [PATCH 5/5] Fixed style --- .../CHIP/MTRDeviceControllerOverXPC.m | 4 +- .../Framework/CHIPTests/MTRClustersTests.m | 26 +- .../Framework/CHIPTests/MTRControllerTests.m | 8 +- .../Framework/CHIPTests/MTRDeviceTests.m | 24 +- .../CHIPTests/MTRXPCListenerSampleTests.m | 274 +++---- .../Framework/CHIPTests/MTRXPCProtocolTests.m | 690 +++++++++--------- 6 files changed, 514 insertions(+), 512 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m index f9919655357507..54463a59f99a65 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.m @@ -97,7 +97,9 @@ - (nullable MTRBaseDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error: return nil; } -- (BOOL)getBaseDevice:(uint64_t)deviceID queue:(dispatch_queue_t)queue completionHandler:(MTRDeviceConnectionCallback)completionHandler +- (BOOL)getBaseDevice:(uint64_t)deviceID + queue:(dispatch_queue_t)queue + completionHandler:(MTRDeviceConnectionCallback)completionHandler { dispatch_async(_workQueue, ^{ dispatch_group_t group = dispatch_group_create(); diff --git a/src/darwin/Framework/CHIPTests/MTRClustersTests.m b/src/darwin/Framework/CHIPTests/MTRClustersTests.m index 481a19637ce66e..bdab9a531ea21e 100644 --- a/src/darwin/Framework/CHIPTests/MTRClustersTests.m +++ b/src/darwin/Framework/CHIPTests/MTRClustersTests.m @@ -140,12 +140,12 @@ - (void)testInitStack __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; [controller getBaseDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [connectionExpectation fulfill]; - connectionExpectation = nil; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertEqual(error.code, 0); + [connectionExpectation fulfill]; + connectionExpectation = nil; + }]; [self waitForExpectationsWithTimeout:kCASESetupTimeoutInSeconds handler:nil]; } @@ -169,13 +169,13 @@ - (void)testReuseChipClusterObject __block MTRBaseDevice * device; __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; [controller getBaseDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable retrievedDevice, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [connectionExpectation fulfill]; - connectionExpectation = nil; - device = retrievedDevice; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable retrievedDevice, NSError * _Nullable error) { + XCTAssertEqual(error.code, 0); + [connectionExpectation fulfill]; + connectionExpectation = nil; + device = retrievedDevice; + }]; [self waitForExpectationsWithTimeout:kCASESetupTimeoutInSeconds handler:nil]; XCTestExpectation * expectation = [self expectationWithDescription:@"ReuseMTRClusterObjectFirstCall"]; diff --git a/src/darwin/Framework/CHIPTests/MTRControllerTests.m b/src/darwin/Framework/CHIPTests/MTRControllerTests.m index bf4e344ee98031..c4e7955c6890c1 100644 --- a/src/darwin/Framework/CHIPTests/MTRControllerTests.m +++ b/src/darwin/Framework/CHIPTests/MTRControllerTests.m @@ -182,10 +182,10 @@ - (void)testControllerInvalidAccess XCTAssertFalse([controller isRunning]); XCTAssertFalse([controller getBaseDevice:1234 - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable chipDevice, NSError * _Nullable error) { - XCTAssertEqual(error.code, MTRErrorCodeInvalidState); - }]); + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable chipDevice, NSError * _Nullable error) { + XCTAssertEqual(error.code, MTRErrorCodeInvalidState); + }]); [factory shutdown]; XCTAssertFalse([factory isRunning]); diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 8e485ce1fc7848..676fb31eba184f 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -61,12 +61,12 @@ static void WaitForCommissionee(XCTestExpectation * expectation, dispatch_queue_ XCTAssertNotNil(controller); [controller getBaseDevice:kDeviceId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [expectation fulfill]; - mConnectedDevice = device; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertEqual(error.code, 0); + [expectation fulfill]; + mConnectedDevice = device; + }]; } static MTRBaseDevice * GetConnectedDevice(void) @@ -178,12 +178,12 @@ - (void)initStack __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; [controller getBaseDevice:kDeviceId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [connectionExpectation fulfill]; - connectionExpectation = nil; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertEqual(error.code, 0); + [connectionExpectation fulfill]; + connectionExpectation = nil; + }]; [self waitForExpectationsWithTimeout:kCASESetupTimeoutInSeconds handler:nil]; } diff --git a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m index f50d84d872ddec..6536ed5bf7b772 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m @@ -171,23 +171,23 @@ - (void)readAttributeWithController:(id)controller __auto_type sharedController = sController; if (sharedController) { [sharedController getBaseDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - completion(nil, error); - } else { - [device readAttributeWithEndpointId:endpointId - clusterId:clusterId - attributeId:attributeId - params:[MTRDeviceController decodeXPCReadParams:params] - clientQueue:dispatch_get_main_queue() - completion:^(NSArray *> * _Nullable values, - NSError * _Nullable error) { - completion([MTRDeviceController encodeXPCResponseValues:values], error); - }]; - } - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + completion(nil, error); + } else { + [device readAttributeWithEndpointId:endpointId + clusterId:clusterId + attributeId:attributeId + params:[MTRDeviceController decodeXPCReadParams:params] + clientQueue:dispatch_get_main_queue() + completion:^(NSArray *> * _Nullable values, + NSError * _Nullable error) { + completion([MTRDeviceController encodeXPCResponseValues:values], error); + }]; + } + }]; } else { NSLog(@"Failed to get shared controller"); completion(nil, [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeGeneralError userInfo:nil]); @@ -207,24 +207,24 @@ - (void)writeAttributeWithController:(id)controller __auto_type sharedController = sController; if (sharedController) { [sharedController getBaseDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - completion(nil, error); - } else { - [device writeAttributeWithEndpointId:endpointId - clusterId:clusterId - attributeId:attributeId - value:value - timedWriteTimeout:timeoutMs - clientQueue:dispatch_get_main_queue() - completion:^(NSArray *> * _Nullable values, - NSError * _Nullable error) { - completion([MTRDeviceController encodeXPCResponseValues:values], error); - }]; - } - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + completion(nil, error); + } else { + [device writeAttributeWithEndpointId:endpointId + clusterId:clusterId + attributeId:attributeId + value:value + timedWriteTimeout:timeoutMs + clientQueue:dispatch_get_main_queue() + completion:^(NSArray *> * _Nullable values, + NSError * _Nullable error) { + completion([MTRDeviceController encodeXPCResponseValues:values], error); + }]; + } + }]; } else { NSLog(@"Failed to get shared controller"); completion(nil, [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeGeneralError userInfo:nil]); @@ -244,24 +244,24 @@ - (void)invokeCommandWithController:(id)controller __auto_type sharedController = sController; if (sharedController) { [sharedController getBaseDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - completion(nil, error); - } else { - [device invokeCommandWithEndpointId:endpointId - clusterId:clusterId - commandId:commandId - commandFields:fields - timedInvokeTimeout:nil - clientQueue:dispatch_get_main_queue() - completion:^(NSArray *> * _Nullable values, - NSError * _Nullable error) { - completion([MTRDeviceController encodeXPCResponseValues:values], error); - }]; - } - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + completion(nil, error); + } else { + [device invokeCommandWithEndpointId:endpointId + clusterId:clusterId + commandId:commandId + commandFields:fields + timedInvokeTimeout:nil + clientQueue:dispatch_get_main_queue() + completion:^(NSArray *> * _Nullable values, + NSError * _Nullable error) { + completion([MTRDeviceController encodeXPCResponseValues:values], error); + }]; + } + }]; } else { NSLog(@"Failed to get shared controller"); completion(nil, [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeGeneralError userInfo:nil]); @@ -281,38 +281,38 @@ - (void)subscribeAttributeWithController:(id)controller __auto_type sharedController = sController; if (sharedController) { [sharedController getBaseDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - establishedHandler(); - // Send an error report so that the client knows of the failure - [self.clientProxy handleReportWithController:controller - nodeId:nodeId - values:nil - error:[NSError errorWithDomain:MTRErrorDomain - code:MTRErrorCodeGeneralError - userInfo:nil]]; - } else { - [device subscribeAttributeWithEndpointId:endpointId - clusterId:clusterId - attributeId:attributeId - minInterval:minInterval - maxInterval:maxInterval - params:[MTRDeviceController decodeXPCSubscribeParams:params] - clientQueue:dispatch_get_main_queue() - reportHandler:^(NSArray *> * _Nullable values, - NSError * _Nullable error) { - [self.clientProxy - handleReportWithController:controller - nodeId:nodeId - values:[MTRDeviceController - encodeXPCResponseValues:values] - error:error]; - } - subscriptionEstablished:establishedHandler]; - } - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + establishedHandler(); + // Send an error report so that the client knows of the failure + [self.clientProxy handleReportWithController:controller + nodeId:nodeId + values:nil + error:[NSError errorWithDomain:MTRErrorDomain + code:MTRErrorCodeGeneralError + userInfo:nil]]; + } else { + [device subscribeAttributeWithEndpointId:endpointId + clusterId:clusterId + attributeId:attributeId + minInterval:minInterval + maxInterval:maxInterval + params:[MTRDeviceController decodeXPCSubscribeParams:params] + clientQueue:dispatch_get_main_queue() + reportHandler:^(NSArray *> * _Nullable values, + NSError * _Nullable error) { + [self.clientProxy + handleReportWithController:controller + nodeId:nodeId + values:[MTRDeviceController + encodeXPCResponseValues:values] + error:error]; + } + subscriptionEstablished:establishedHandler]; + } + }]; } else { NSLog(@"Failed to get shared controller"); establishedHandler(); @@ -331,14 +331,14 @@ - (void)stopReportsWithController:(id _Nullable)controller nodeId:(uint64_t)node __auto_type sharedController = sController; if (sharedController) { [sharedController getBaseDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Failed to get connected device"); - } else { - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:completion]; - } - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get connected device"); + } else { + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() completion:completion]; + } + }]; } else { NSLog(@"Failed to get shared controller"); completion(); @@ -361,42 +361,42 @@ - (void)subscribeWithController:(id _Nullable)controller } [sharedController getBaseDevice:nodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@", nodeId, error); - completion(error); - return; - } - NSMutableArray * established = [NSMutableArray arrayWithCapacity:1]; - [established addObject:@NO]; - [device subscribeWithQueue:dispatch_get_main_queue() - minInterval:[minInterval unsignedShortValue] - maxInterval:[maxInterval unsignedShortValue] - params:[MTRDeviceController decodeXPCSubscribeParams:params] - cacheContainer:attributeCacheContainer - attributeReportHandler:^(NSArray * value) { - NSLog(@"Received report: %@", value); - } - eventReportHandler:nil - errorHandler:^(NSError * error) { - NSLog(@"Received report error: %@", error); - if (![established[0] boolValue]) { - established[0] = @YES; - completion(error); - } + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@", nodeId, error); + completion(error); + return; } - subscriptionEstablished:^() { - NSLog(@"Attribute cache subscription succeeded for device %llu", nodeId); - if (attributeCacheContainer) { - [self.attributeCacheDictionary setObject:attributeCacheContainer forKey:@(nodeId)]; + NSMutableArray * established = [NSMutableArray arrayWithCapacity:1]; + [established addObject:@NO]; + [device subscribeWithQueue:dispatch_get_main_queue() + minInterval:[minInterval unsignedShortValue] + maxInterval:[maxInterval unsignedShortValue] + params:[MTRDeviceController decodeXPCSubscribeParams:params] + cacheContainer:attributeCacheContainer + attributeReportHandler:^(NSArray * value) { + NSLog(@"Received report: %@", value); } - if (![established[0] boolValue]) { - established[0] = @YES; - completion(nil); + eventReportHandler:nil + errorHandler:^(NSError * error) { + NSLog(@"Received report error: %@", error); + if (![established[0] boolValue]) { + established[0] = @YES; + completion(error); + } } - }]; - }]; + subscriptionEstablished:^() { + NSLog(@"Attribute cache subscription succeeded for device %llu", nodeId); + if (attributeCacheContainer) { + [self.attributeCacheDictionary setObject:attributeCacheContainer forKey:@(nodeId)]; + } + if (![established[0] boolValue]) { + established[0] = @YES; + completion(nil); + } + }]; + }]; } else { NSLog(@"Failed to get shared controller"); completion([NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeGeneralError userInfo:nil]); @@ -547,12 +547,12 @@ - (void)initStack __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; [controller getBaseDevice:kDeviceId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertEqual(error.code, 0); - [connectionExpectation fulfill]; - connectionExpectation = nil; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertEqual(error.code, 0); + [connectionExpectation fulfill]; + connectionExpectation = nil; + }]; [self waitForExpectationsWithTimeout:kCASESetupTimeoutInSeconds handler:nil]; mSampleListener = [[MTRXPCListenerSample alloc] init]; @@ -590,11 +590,11 @@ - (void)waitForCommissionee return nil; }]; [remoteController getBaseDevice:kDeviceId - queue:queue - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - mConnectedDevice = device; - [expectation fulfill]; - }]; + queue:queue + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + mConnectedDevice = device; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; mDeviceController = remoteController; } diff --git a/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m b/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m index 80a6409a83ecc0..017313aad905fd 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m @@ -99,39 +99,39 @@ - (void)subscribeWithDeviceController:(MTRDeviceController *)deviceController }); }; [deviceController getBaseDevice:deviceId - queue:workQueue - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@", deviceId, error); - completionHandler(error); - return; - } - __auto_type established = [NSMutableArray arrayWithCapacity:1]; - [established addObject:@NO]; - [device subscribeWithQueue:clientQueue - minInterval:1 - maxInterval:43200 - params:params - cacheContainer:self - attributeReportHandler:^(NSArray * value) { - NSLog(@"Report received for attribute cache: %@", value); + queue:workQueue + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@", deviceId, error); + completionHandler(error); + return; } - eventReportHandler:nil - errorHandler:^(NSError * error) { - NSLog(@"Report error received for attribute cache: %@", error); - if (![established[0] boolValue]) { - established[0] = @YES; - completionHandler(error); + __auto_type established = [NSMutableArray arrayWithCapacity:1]; + [established addObject:@NO]; + [device subscribeWithQueue:clientQueue + minInterval:1 + maxInterval:43200 + params:params + cacheContainer:self + attributeReportHandler:^(NSArray * value) { + NSLog(@"Report received for attribute cache: %@", value); } - } - subscriptionEstablished:^() { - NSLog(@"Attribute cache subscription succeeded for device %llu", deviceId); - if (![established[0] boolValue]) { - established[0] = @YES; - completionHandler(nil); + eventReportHandler:nil + errorHandler:^(NSError * error) { + NSLog(@"Report error received for attribute cache: %@", error); + if (![established[0] boolValue]) { + established[0] = @YES; + completionHandler(error); + } } - }]; - }]; + subscriptionEstablished:^() { + NSLog(@"Attribute cache subscription succeeded for device %llu", deviceId); + if (![established[0] boolValue]) { + established[0] = @YES; + completionHandler(nil); + } + }]; + }]; } @end @@ -364,26 +364,26 @@ - (void)testReadAttributeSuccess }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Reading..."); - [device readAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - params:nil - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Read value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myValues isEqualTo:value]); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Reading..."); + [device readAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + params:nil + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Read value: %@", value); + XCTAssertNotNil(value); + XCTAssertNil(error); + XCTAssertTrue([myValues isEqualTo:value]); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -426,26 +426,26 @@ - (void)testReadAttributeWithParamsSuccess }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Reading..."); - [device readAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - params:myParams - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Read value: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myValues isEqualTo:value]); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Reading..."); + [device readAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + params:myParams + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Read value: %@", value); + XCTAssertNotNil(value); + XCTAssertNil(error); + XCTAssertTrue([myValues isEqualTo:value]); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -479,25 +479,25 @@ - (void)testReadAttributeFailure }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Reading..."); - [device readAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - params:nil - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Read value: %@", value); - XCTAssertNil(value); - XCTAssertNotNil(error); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Reading..."); + [device readAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + params:nil + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Read value: %@", value); + XCTAssertNil(value); + XCTAssertNotNil(error); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -538,27 +538,27 @@ - (void)testWriteAttributeSuccess }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Writing..."); - [device writeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - value:myValue - timedWriteTimeout:nil - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Write response: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myResults isEqualTo:value]); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Writing..."); + [device writeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + value:myValue + timedWriteTimeout:nil + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Write response: %@", value); + XCTAssertNotNil(value); + XCTAssertNil(error); + XCTAssertTrue([myResults isEqualTo:value]); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -601,27 +601,27 @@ - (void)testTimedWriteAttributeSuccess }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Writing..."); - [device writeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - value:myValue - timedWriteTimeout:myTimedWriteTimeout - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Write response: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myResults isEqualTo:value]); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Writing..."); + [device writeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + value:myValue + timedWriteTimeout:myTimedWriteTimeout + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Write response: %@", value); + XCTAssertNotNil(value); + XCTAssertNil(error); + XCTAssertTrue([myResults isEqualTo:value]); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -657,26 +657,26 @@ - (void)testWriteAttributeFailure }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Writing..."); - [device writeAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - value:myValue - timedWriteTimeout:nil - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Write response: %@", value); - XCTAssertNil(value); - XCTAssertNotNil(error); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Writing..."); + [device writeAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + value:myValue + timedWriteTimeout:nil + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Write response: %@", value); + XCTAssertNil(value); + XCTAssertNotNil(error); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -717,27 +717,27 @@ - (void)testInvokeCommandSuccess }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Invoking command..."); - [device invokeCommandWithEndpointId:myEndpointId - clusterId:myClusterId - commandId:myCommandId - commandFields:myFields - timedInvokeTimeout:nil - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Command response: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myResults isEqualTo:value]); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Invoking command..."); + [device invokeCommandWithEndpointId:myEndpointId + clusterId:myClusterId + commandId:myCommandId + commandFields:myFields + timedInvokeTimeout:nil + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Command response: %@", value); + XCTAssertNotNil(value); + XCTAssertNil(error); + XCTAssertTrue([myResults isEqualTo:value]); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -780,27 +780,27 @@ - (void)testTimedInvokeCommandSuccess }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Invoking command..."); - [device invokeCommandWithEndpointId:myEndpointId - clusterId:myClusterId - commandId:myCommandId - commandFields:myFields - timedInvokeTimeout:myTimedInvokeTimeout - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Command response: %@", value); - XCTAssertNotNil(value); - XCTAssertNil(error); - XCTAssertTrue([myResults isEqualTo:value]); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Invoking command..."); + [device invokeCommandWithEndpointId:myEndpointId + clusterId:myClusterId + commandId:myCommandId + commandFields:myFields + timedInvokeTimeout:myTimedInvokeTimeout + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Command response: %@", value); + XCTAssertNotNil(value); + XCTAssertNil(error); + XCTAssertTrue([myResults isEqualTo:value]); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -839,26 +839,26 @@ - (void)testInvokeCommandFailure }; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Invoking command..."); - [device invokeCommandWithEndpointId:myEndpointId - clusterId:myClusterId - commandId:myCommandId - commandFields:myFields - timedInvokeTimeout:nil - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Command response: %@", value); - XCTAssertNil(value); - XCTAssertNotNil(error); - [responseExpectation fulfill]; - self.xpcDisconnectExpectation = - [self expectationWithDescription:@"XPC Disconnected"]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Invoking command..."); + [device invokeCommandWithEndpointId:myEndpointId + clusterId:myClusterId + commandId:myCommandId + commandFields:myFields + timedInvokeTimeout:nil + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Command response: %@", value); + XCTAssertNil(value); + XCTAssertNotNil(error); + [responseExpectation fulfill]; + self.xpcDisconnectExpectation = + [self expectationWithDescription:@"XPC Disconnected"]; + }]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds]; @@ -904,7 +904,7 @@ - (void)testSubscribeAttributeSuccess _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -968,14 +968,14 @@ - (void)testSubscribeAttributeSuccess // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1024,7 +1024,7 @@ - (void)testSubscribeAttributeWithParamsSuccess _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1088,14 +1088,14 @@ - (void)testSubscribeAttributeWithParamsSuccess // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1139,7 +1139,7 @@ - (void)testBadlyFormattedReport _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1201,14 +1201,14 @@ - (void)testBadlyFormattedReport // Deregister report handler _xpcDisconnectExpectation.inverted = NO; [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1253,7 +1253,7 @@ - (void)testReportWithUnrelatedEndpointId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1317,14 +1317,14 @@ - (void)testReportWithUnrelatedEndpointId // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1369,7 +1369,7 @@ - (void)testReportWithUnrelatedClusterId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1433,14 +1433,14 @@ - (void)testReportWithUnrelatedClusterId // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1485,7 +1485,7 @@ - (void)testReportWithUnrelatedAttributeId _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1549,14 +1549,14 @@ - (void)testReportWithUnrelatedAttributeId // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1601,7 +1601,7 @@ - (void)testReportWithUnrelatedNode _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1665,14 +1665,14 @@ - (void)testReportWithUnrelatedNode // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1716,7 +1716,7 @@ - (void)testSubscribeMultiEndpoints _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1780,14 +1780,14 @@ - (void)testSubscribeMultiEndpoints // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1831,7 +1831,7 @@ - (void)testSubscribeMultiClusters _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -1895,14 +1895,14 @@ - (void)testSubscribeMultiClusters // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -1946,7 +1946,7 @@ - (void)testSubscribeMultiAttributes _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -2010,14 +2010,14 @@ - (void)testSubscribeMultiAttributes // Deregister report handler [_remoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + }]; + }]; // Wait for disconnection [self waitForExpectations:@[ _xpcDisconnectExpectation, stopExpectation ] timeout:kTimeoutInSeconds]; @@ -2072,7 +2072,7 @@ - (void)testMutiSubscriptions callExpectation = [self expectationWithDescription:[NSString stringWithFormat:@"XPC call (%d) received", i]]; establishExpectation = [self expectationWithDescription:[NSString stringWithFormat:@"Established (%d) called", i]]; [_remoteDeviceController - getBaseDevice:myNodeId + getBaseDevice:myNodeId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { XCTAssertNotNil(device); @@ -2147,15 +2147,15 @@ - (void)testMutiSubscriptions // Deregister report handler for first subscriber __auto_type deregisterExpectation = [self expectationWithDescription:@"First subscriber deregistered"]; [_remoteDeviceController getBaseDevice:nodeToStop - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - [deregisterExpectation fulfill]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + [deregisterExpectation fulfill]; + }]; + }]; [self waitForExpectations:@[ stopExpectation, deregisterExpectation ] timeout:kTimeoutInSeconds]; @@ -2205,15 +2205,15 @@ - (void)testMutiSubscriptions // Deregister report handler for second subscriber __auto_type secondDeregisterExpectation = [self expectationWithDescription:@"Second subscriber deregistered"]; [_remoteDeviceController getBaseDevice:nodeToStop - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - NSLog(@"Device acquired. Deregistering..."); - [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() - completion:^{ - NSLog(@"Deregistered"); - [secondDeregisterExpectation fulfill]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + NSLog(@"Device acquired. Deregistering..."); + [device deregisterReportHandlersWithClientQueue:dispatch_get_main_queue() + completion:^{ + NSLog(@"Deregistered"); + [secondDeregisterExpectation fulfill]; + }]; + }]; // Wait for deregistration and disconnection [self waitForExpectations:@[ secondDeregisterExpectation, _xpcDisconnectExpectation, stopExpectation ] @@ -2275,12 +2275,12 @@ - (void)testAnySharedRemoteController __auto_type deviceAcquired = [self expectationWithDescription:@"Connected device was acquired"]; [unspecifiedRemoteDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - [deviceAcquired fulfill]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + [deviceAcquired fulfill]; + }]; [self waitForExpectations:[NSArray arrayWithObjects:anySharedRemoteControllerCallExpectation, deviceAcquired, nil] timeout:kTimeoutInSeconds]; @@ -2535,23 +2535,23 @@ - (void)testXPCConnectionFailure }]; [failingDeviceController getBaseDevice:myNodeId - queue:dispatch_get_main_queue() - completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { - XCTAssertNotNil(device); - XCTAssertNil(error); - NSLog(@"Device acquired. Reading..."); - [device readAttributeWithEndpointId:myEndpointId - clusterId:myClusterId - attributeId:myAttributeId - params:nil - clientQueue:dispatch_get_main_queue() - completion:^(id _Nullable value, NSError * _Nullable error) { - NSLog(@"Read value: %@", value); - XCTAssertNil(value); - XCTAssertNotNil(error); - [responseExpectation fulfill]; - }]; - }]; + queue:dispatch_get_main_queue() + completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { + XCTAssertNotNil(device); + XCTAssertNil(error); + NSLog(@"Device acquired. Reading..."); + [device readAttributeWithEndpointId:myEndpointId + clusterId:myClusterId + attributeId:myAttributeId + params:nil + clientQueue:dispatch_get_main_queue() + completion:^(id _Nullable value, NSError * _Nullable error) { + NSLog(@"Read value: %@", value); + XCTAssertNil(value); + XCTAssertNotNil(error); + [responseExpectation fulfill]; + }]; + }]; [self waitForExpectations:@[ responseExpectation ] timeout:kTimeoutInSeconds]; }