diff --git a/examples/darwin-framework-tool/BUILD.gn b/examples/darwin-framework-tool/BUILD.gn index 513be497c1fb4f..7a9d459fe5f918 100644 --- a/examples/darwin-framework-tool/BUILD.gn +++ b/examples/darwin-framework-tool/BUILD.gn @@ -99,10 +99,10 @@ executable("darwin-framework-tool") { "commands/common/MTRError_Utils.h", "commands/common/MTRLogging.h", "commands/pairing/Commands.h", + "commands/pairing/DeviceControllerDelegateBridge.mm", "commands/pairing/OpenCommissioningWindowCommand.h", "commands/pairing/OpenCommissioningWindowCommand.mm", "commands/pairing/PairingCommandBridge.mm", - "commands/pairing/PairingDelegateBridge.mm", "commands/payload/SetupPayloadParseCommand.mm", "commands/provider/Commands.h", "commands/provider/OTAProviderDelegate.mm", diff --git a/examples/darwin-framework-tool/commands/pairing/PairingDelegateBridge.h b/examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.h similarity index 92% rename from examples/darwin-framework-tool/commands/pairing/PairingDelegateBridge.h rename to examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.h index e295e084725701..1c48daba882f0a 100644 --- a/examples/darwin-framework-tool/commands/pairing/PairingDelegateBridge.h +++ b/examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.h @@ -20,7 +20,7 @@ #import -@interface CHIPToolPairingDelegate : NSObject +@interface CHIPToolDeviceControllerDelegate : NSObject @property PairingCommandBridge * commandBridge; @property chip::NodeId deviceID; @property MTRDeviceController * commissioner; diff --git a/examples/darwin-framework-tool/commands/pairing/PairingDelegateBridge.mm b/examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.mm similarity index 84% rename from examples/darwin-framework-tool/commands/pairing/PairingDelegateBridge.mm rename to examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.mm index da87dc349b8eff..2245c01f1aa2dc 100644 --- a/examples/darwin-framework-tool/commands/pairing/PairingDelegateBridge.mm +++ b/examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.mm @@ -16,29 +16,29 @@ * */ -#include "PairingDelegateBridge.h" +#include "DeviceControllerDelegateBridge.h" #import -@interface CHIPToolPairingDelegate () +@interface CHIPToolDeviceControllerDelegate () @end -@implementation CHIPToolPairingDelegate -- (void)onStatusUpdate:(MTRPairingStatus)status +@implementation CHIPToolDeviceControllerDelegate +- (void)onStatusUpdate:(MTRCommissioningStatus)status { NSLog(@"Pairing Status Update: %lu", status); switch (status) { - case MTRPairingStatusSuccess: + case MTRCommissioningStatusSuccess: ChipLogProgress(chipTool, "Secure Pairing Success"); ChipLogProgress(chipTool, "CASE establishment successful"); break; - case MTRPairingStatusFailed: + case MTRCommissioningStatusFailed: ChipLogError(chipTool, "Secure Pairing Failed"); _commandBridge->SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE); break; - case MTRPairingStatusDiscoveringMoreDevices: + case MTRCommissioningStatusDiscoveringMoreDevices: ChipLogProgress(chipTool, "Secure Pairing Discovering More Devices"); break; - case MTRPairingStatusUnknown: + case MTRCommissioningStatusUnknown: ChipLogError(chipTool, "Uknown Pairing Status"); break; } diff --git a/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.h b/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.h index 4885b328c8ad9a..1b098adba25937 100644 --- a/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.h +++ b/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.h @@ -78,7 +78,7 @@ class PairingCommandBridge : public CHIPCommandBridge void PairWithCode(NSError * __autoreleasing * error); void PairWithPayload(NSError * __autoreleasing * error); void Unpair(); - void SetUpPairingDelegate(); + void SetUpDeviceControllerDelegate(); const PairingMode mPairingMode; const PairingNetworkType mNetworkType; diff --git a/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.mm b/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.mm index a06c40a5265d35..8bbda27ef8d420 100644 --- a/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.mm +++ b/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.mm @@ -19,8 +19,8 @@ #import #include "../common/CHIPCommandBridge.h" +#include "DeviceControllerDelegateBridge.h" #include "PairingCommandBridge.h" -#include "PairingDelegateBridge.h" #include #import "MTRError_Utils.h" @@ -28,14 +28,14 @@ using namespace ::chip; using namespace ::chip::Controller; -void PairingCommandBridge::SetUpPairingDelegate() +void PairingCommandBridge::SetUpDeviceControllerDelegate() { dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.pairing", DISPATCH_QUEUE_SERIAL); - CHIPToolPairingDelegate * pairing = [[CHIPToolPairingDelegate alloc] init]; + CHIPToolDeviceControllerDelegate * deviceControllerDelegate = [[CHIPToolDeviceControllerDelegate alloc] init]; MTRCommissioningParameters * params = [[MTRCommissioningParameters alloc] init]; MTRDeviceController * commissioner = CurrentCommissioner(); - [pairing setDeviceID:mNodeId]; + [deviceControllerDelegate setDeviceID:mNodeId]; switch (mNetworkType) { case PairingNetworkType::None: case PairingNetworkType::Ethernet: @@ -49,11 +49,11 @@ break; } - [pairing setCommandBridge:this]; - [pairing setParams:params]; - [pairing setCommissioner:commissioner]; + [deviceControllerDelegate setCommandBridge:this]; + [deviceControllerDelegate setParams:params]; + [deviceControllerDelegate setCommissioner:commissioner]; - [commissioner setPairingDelegate:pairing queue:callbackQueue]; + [commissioner setDeviceControllerDelegate:deviceControllerDelegate queue:callbackQueue]; } CHIP_ERROR PairingCommandBridge::RunCommand() @@ -79,7 +79,7 @@ void PairingCommandBridge::PairWithCode(NSError * __autoreleasing * error) { - SetUpPairingDelegate(); + SetUpDeviceControllerDelegate(); auto * payload = [[MTRSetupPayload alloc] initWithSetupPasscode:@(mSetupPINCode) discriminator:@(mDiscriminator)]; MTRDeviceController * commissioner = CurrentCommissioner(); [commissioner setupCommissioningSessionWithPayload:payload newNodeID:@(mNodeId) error:error]; @@ -88,7 +88,7 @@ void PairingCommandBridge::PairWithPayload(NSError * __autoreleasing * error) { NSString * onboardingPayload = [NSString stringWithUTF8String:mOnboardingPayload]; - SetUpPairingDelegate(); + SetUpDeviceControllerDelegate(); auto * payload = [MTRSetupPayload setupPayloadWithOnboardingPayload:onboardingPayload error:error]; if (payload == nil) { return; diff --git a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h index 03f6b70aae719b..8c4fe33d0ea87f 100644 --- a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h +++ b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h @@ -43,12 +43,12 @@ const char * getScriptsFolder() { return basePath; } constexpr const char * kDefaultKey = "default"; -@interface TestPairingDelegate : NSObject +@interface TestDeviceControllerDelegate : NSObject @property TestCommandBridge * commandBridge; @property chip::NodeId deviceId; @property BOOL active; // Whether to pass on notifications to the commandBridge -- (void)onStatusUpdate:(MTRPairingStatus)status; +- (void)onStatusUpdate:(MTRCommissioningStatus)status; - (void)onPairingComplete:(NSError * _Nullable)error; - (void)onPairingDeleted:(NSError * _Nullable)error; - (void)onCommissioningComplete:(NSError * _Nullable)error; @@ -70,7 +70,7 @@ class TestCommandBridge : public CHIPCommandBridge, public: TestCommandBridge(const char * _Nonnull commandName) : CHIPCommandBridge(commandName) - , mPairingDelegate([[TestPairingDelegate alloc] initWithTestCommandBridge:this]) + , mDeviceControllerDelegate([[TestDeviceControllerDelegate alloc] initWithTestCommandBridge:this]) { AddArgument("delayInMs", 0, UINT64_MAX, &mDelayInMs); AddArgument("PICS", &mPICSFilePath); @@ -183,9 +183,9 @@ class TestCommandBridge : public CHIPCommandBridge, SetIdentity(identity); - [controller setPairingDelegate:mPairingDelegate queue:mCallbackQueue]; - [mPairingDelegate setDeviceId:value.nodeId]; - [mPairingDelegate setActive:YES]; + [controller setDeviceControllerDelegate:mDeviceControllerDelegate queue:mCallbackQueue]; + [mDeviceControllerDelegate setDeviceId:value.nodeId]; + [mDeviceControllerDelegate setActive:YES]; NSString * payloadStr = [[NSString alloc] initWithBytes:value.payload.data() length:value.payload.size() @@ -521,7 +521,7 @@ class TestCommandBridge : public CHIPCommandBridge, } private: - TestPairingDelegate * _Nonnull mPairingDelegate; + TestDeviceControllerDelegate * _Nonnull mDeviceControllerDelegate; // Set of our connected devices, keyed by identity. std::map mConnectedDevices; @@ -529,13 +529,13 @@ class TestCommandBridge : public CHIPCommandBridge, NS_ASSUME_NONNULL_BEGIN -@implementation TestPairingDelegate -- (void)onStatusUpdate:(MTRPairingStatus)status +@implementation TestDeviceControllerDelegate +- (void)onStatusUpdate:(MTRCommissioningStatus)status { if (_active) { - if (status == MTRPairingStatusSuccess) { + if (status == MTRCommissioningStatusSuccess) { NSLog(@"Secure pairing success"); - } else if (status == MTRPairingStatusFailed) { + } else if (status == MTRCommissioningStatusFailed) { _active = NO; NSLog(@"Secure pairing failed"); _commandBridge->OnStatusUpdate(chip::app::StatusIB(chip::Protocols::InteractionModel::Status::Failure)); diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.h b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.h index 77d143c2c5a2bb..85a2f1f133f2f5 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.h +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.h @@ -21,6 +21,6 @@ #import @interface QRCodeViewController - : UIViewController + : UIViewController @end diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index adffc96973fafa..829b8e0bae6d43 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -489,7 +489,7 @@ - (void)setVendorIDOnAccessory } } -// MARK: MTRDevicePairingDelegate +// MARK: MTRDeviceControllerDelegate - (void)onPairingComplete:(NSError * _Nullable)error { if (error != nil) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index 66486c84e621fd..c3b49508a1cb87 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN @class MTRCommissioningParameters; -@protocol MTRDevicePairingDelegate; +@protocol MTRDeviceControllerDelegate; @class MTRSetupPayload; @interface MTRDeviceController : NSObject @@ -109,7 +109,7 @@ NS_ASSUME_NONNULL_BEGIN * * @param[in] queue The queue on which the callbacks will be delivered */ -- (void)setPairingDelegate:(id)delegate queue:(dispatch_queue_t)queue; +- (void)setDeviceControllerDelegate:(id)delegate queue:(dispatch_queue_t)queue; /** * Sets this MTRDeviceController to use the given issuer for issuing operational certs. By default, the MTRDeviceController uses an diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 9b623624a65fdf..e51c7f435d36c9 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -20,10 +20,10 @@ #import "MTRBaseDevice_Internal.h" #import "MTRCommissioningParameters.h" +#import "MTRDeviceControllerDelegateBridge.h" #import "MTRDeviceControllerFactory_Internal.h" #import "MTRDeviceControllerStartupParams.h" #import "MTRDeviceControllerStartupParams_Internal.h" -#import "MTRDevicePairingDelegateBridge.h" #import "MTRDevice_Internal.h" #import "MTRError_Internal.h" #import "MTRKeypair.h" @@ -83,7 +83,7 @@ @interface MTRDeviceController () @property (readonly) chip::Controller::DeviceCommissioner * cppCommissioner; @property (readonly) chip::Credentials::PartialDACVerifier * partialDACVerifier; -@property (readonly) MTRDevicePairingDelegateBridge * pairingDelegateBridge; +@property (readonly) MTRDeviceControllerDelegateBridge * deviceControllerDelegateBridge; @property (readonly) MTROperationalCredentialsDelegate * operationalCredentialsDelegate; @property (readonly) MTRP256KeypairBridge signingKeypairBridge; @property (readonly) MTRP256KeypairBridge operationalKeypairBridge; @@ -103,8 +103,8 @@ - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory queue:(dis _deviceMapLock = OS_UNFAIR_LOCK_INIT; _nodeIDToDeviceMap = [NSMutableDictionary dictionary]; - _pairingDelegateBridge = new MTRDevicePairingDelegateBridge(); - if ([self checkForInitError:(_pairingDelegateBridge != nullptr) logMsg:kErrorPairingInit]) { + _deviceControllerDelegateBridge = new MTRDeviceControllerDelegateBridge(); + if ([self checkForInitError:(_deviceControllerDelegateBridge != nullptr) logMsg:kErrorPairingInit]) { return nil; } @@ -183,9 +183,9 @@ - (void)cleanup _partialDACVerifier = nullptr; } - if (_pairingDelegateBridge) { - delete _pairingDelegateBridge; - _pairingDelegateBridge = nullptr; + if (_deviceControllerDelegateBridge) { + delete _deviceControllerDelegateBridge; + _deviceControllerDelegateBridge = nullptr; } } @@ -255,7 +255,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams chip::Controller::SetupParams commissionerParams; - commissionerParams.pairingDelegate = _pairingDelegateBridge; + commissionerParams.pairingDelegate = _deviceControllerDelegateBridge; _operationalCredentialsDelegate->SetDeviceCommissioner(_cppCommissioner); @@ -533,10 +533,10 @@ - (void)removeDevice:(MTRDevice *)device os_unfair_lock_unlock(&_deviceMapLock); } -- (void)setPairingDelegate:(id)delegate queue:(dispatch_queue_t)queue +- (void)setDeviceControllerDelegate:(id)delegate queue:(dispatch_queue_t)queue { dispatch_async(_chipWorkQueue, ^{ - self->_pairingDelegateBridge->setDelegate(delegate, queue); + self->_deviceControllerDelegateBridge->setDelegate(delegate, queue); }); } diff --git a/src/darwin/Framework/CHIP/MTRDevicePairingDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h similarity index 76% rename from src/darwin/Framework/CHIP/MTRDevicePairingDelegate.h rename to src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 0ecce764b66908..9fcacd903e216e 100644 --- a/src/darwin/Framework/CHIP/MTRDevicePairingDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -19,25 +19,25 @@ NS_ASSUME_NONNULL_BEGIN -typedef NS_ENUM(NSUInteger, MTRPairingStatus) { - MTRPairingStatusUnknown = 0, - MTRPairingStatusSuccess = 1, - MTRPairingStatusFailed = 2, - MTRPairingStatusDiscoveringMoreDevices = 3 +typedef NS_ENUM(NSUInteger, MTRCommissioningStatus) { + MTRCommissioningStatusUnknown = 0, + MTRCommissioningStatusSuccess = 1, + MTRCommissioningStatusFailed = 2, + MTRCommissioningStatusDiscoveringMoreDevices = 3 }; /** - * The protocol definition for the MTRDevicePairingDelegate + * The protocol definition for the MTRDeviceControllerDelegate * * All delegate methods will be called on the supplied Delegate Queue. */ -@protocol MTRDevicePairingDelegate +@protocol MTRDeviceControllerDelegate @optional /** * Notify the delegate when pairing status gets updated * */ -- (void)onStatusUpdate:(MTRPairingStatus)status; +- (void)onStatusUpdate:(MTRCommissioningStatus)status; /** * Notify the delegate when pairing is completed diff --git a/src/darwin/Framework/CHIP/MTRDevicePairingDelegateBridge.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.h similarity index 71% rename from src/darwin/Framework/CHIP/MTRDevicePairingDelegateBridge.h rename to src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.h index a932319aaf4352..299e85b6a3b5ae 100644 --- a/src/darwin/Framework/CHIP/MTRDevicePairingDelegateBridge.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.h @@ -15,20 +15,20 @@ * limitations under the License. */ -#import "MTRDevicePairingDelegate.h" +#import "MTRDeviceControllerDelegate.h" #include #include NS_ASSUME_NONNULL_BEGIN -class MTRDevicePairingDelegateBridge : public chip::Controller::DevicePairingDelegate +class MTRDeviceControllerDelegateBridge : public chip::Controller::DevicePairingDelegate { public: - MTRDevicePairingDelegateBridge(); - ~MTRDevicePairingDelegateBridge(); + MTRDeviceControllerDelegateBridge(); + ~MTRDeviceControllerDelegateBridge(); - void setDelegate(id delegate, dispatch_queue_t queue); + void setDelegate(id delegate, dispatch_queue_t queue); void OnStatusUpdate(chip::Controller::DevicePairingDelegate::Status status) override; @@ -39,10 +39,10 @@ class MTRDevicePairingDelegateBridge : public chip::Controller::DevicePairingDel void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR error) override; private: - _Nullable id mDelegate; + _Nullable id mDelegate; _Nullable dispatch_queue_t mQueue; - MTRPairingStatus MapStatus(chip::Controller::DevicePairingDelegate::Status status); + MTRCommissioningStatus MapStatus(chip::Controller::DevicePairingDelegate::Status status); }; NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDevicePairingDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm similarity index 57% rename from src/darwin/Framework/CHIP/MTRDevicePairingDelegateBridge.mm rename to src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index f0393f562d8262..7ef07f87ce860c 100644 --- a/src/darwin/Framework/CHIP/MTRDevicePairingDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -15,17 +15,17 @@ * limitations under the License. */ -#import "MTRDevicePairingDelegateBridge.h" +#import "MTRDeviceControllerDelegateBridge.h" #import "MTRError_Internal.h" -MTRDevicePairingDelegateBridge::MTRDevicePairingDelegateBridge(void) +MTRDeviceControllerDelegateBridge::MTRDeviceControllerDelegateBridge(void) : mDelegate(nil) { } -MTRDevicePairingDelegateBridge::~MTRDevicePairingDelegateBridge(void) {} +MTRDeviceControllerDelegateBridge::~MTRDeviceControllerDelegateBridge(void) {} -void MTRDevicePairingDelegateBridge::setDelegate(id delegate, dispatch_queue_t queue) +void MTRDeviceControllerDelegateBridge::setDelegate(id delegate, dispatch_queue_t queue) { if (delegate && queue) { mDelegate = delegate; @@ -36,43 +36,43 @@ } } -MTRPairingStatus MTRDevicePairingDelegateBridge::MapStatus(chip::Controller::DevicePairingDelegate::Status status) +MTRCommissioningStatus MTRDeviceControllerDelegateBridge::MapStatus(chip::Controller::DevicePairingDelegate::Status status) { - MTRPairingStatus rv = MTRPairingStatusUnknown; + MTRCommissioningStatus rv = MTRCommissioningStatusUnknown; switch (status) { case chip::Controller::DevicePairingDelegate::Status::SecurePairingSuccess: - rv = MTRPairingStatusSuccess; + rv = MTRCommissioningStatusSuccess; break; case chip::Controller::DevicePairingDelegate::Status::SecurePairingFailed: - rv = MTRPairingStatusFailed; + rv = MTRCommissioningStatusFailed; break; case chip::Controller::DevicePairingDelegate::Status::SecurePairingDiscoveringMoreDevices: - rv = MTRPairingStatusDiscoveringMoreDevices; + rv = MTRCommissioningStatusDiscoveringMoreDevices; break; } return rv; } -void MTRDevicePairingDelegateBridge::OnStatusUpdate(chip::Controller::DevicePairingDelegate::Status status) +void MTRDeviceControllerDelegateBridge::OnStatusUpdate(chip::Controller::DevicePairingDelegate::Status status) { - NSLog(@"DevicePairingDelegate status updated: %d", status); + NSLog(@"DeviceControllerDelegate status updated: %d", status); - id strongDelegate = mDelegate; + id strongDelegate = mDelegate; if ([strongDelegate respondsToSelector:@selector(onStatusUpdate:)]) { if (strongDelegate && mQueue) { - MTRPairingStatus pairingStatus = MapStatus(status); + MTRCommissioningStatus commissioningStatus = MapStatus(status); dispatch_async(mQueue, ^{ - [strongDelegate onStatusUpdate:pairingStatus]; + [strongDelegate onStatusUpdate:commissioningStatus]; }); } } } -void MTRDevicePairingDelegateBridge::OnPairingComplete(CHIP_ERROR error) +void MTRDeviceControllerDelegateBridge::OnPairingComplete(CHIP_ERROR error) { - NSLog(@"DevicePairingDelegate Pairing complete. Status %s", chip::ErrorStr(error)); + NSLog(@"DeviceControllerDelegate Pairing complete. Status %s", chip::ErrorStr(error)); - id strongDelegate = mDelegate; + id strongDelegate = mDelegate; if ([strongDelegate respondsToSelector:@selector(onPairingComplete:)]) { if (strongDelegate && mQueue) { dispatch_async(mQueue, ^{ @@ -83,11 +83,11 @@ } } -void MTRDevicePairingDelegateBridge::OnPairingDeleted(CHIP_ERROR error) +void MTRDeviceControllerDelegateBridge::OnPairingDeleted(CHIP_ERROR error) { - NSLog(@"DevicePairingDelegate Pairing deleted. Status %s", chip::ErrorStr(error)); + NSLog(@"DeviceControllerDelegate Pairing deleted. Status %s", chip::ErrorStr(error)); - id strongDelegate = mDelegate; + id strongDelegate = mDelegate; if ([strongDelegate respondsToSelector:@selector(onPairingDeleted:)]) { if (strongDelegate && mQueue) { dispatch_async(mQueue, ^{ @@ -98,11 +98,11 @@ } } -void MTRDevicePairingDelegateBridge::OnCommissioningComplete(chip::NodeId nodeId, CHIP_ERROR error) +void MTRDeviceControllerDelegateBridge::OnCommissioningComplete(chip::NodeId nodeId, CHIP_ERROR error) { - NSLog(@"DevicePairingDelegate Commissioning complete. NodeId %llu Status %s", nodeId, chip::ErrorStr(error)); + NSLog(@"DeviceControllerDelegate Commissioning complete. NodeId %llu Status %s", nodeId, chip::ErrorStr(error)); - id strongDelegate = mDelegate; + id strongDelegate = mDelegate; if ([strongDelegate respondsToSelector:@selector(onCommissioningComplete:)]) { if (strongDelegate && mQueue) { dispatch_async(mQueue, ^{ diff --git a/src/darwin/Framework/CHIP/Matter.h b/src/darwin/Framework/CHIP/Matter.h index 81c89158317551..975785fdd34d24 100644 --- a/src/darwin/Framework/CHIP/Matter.h +++ b/src/darwin/Framework/CHIP/Matter.h @@ -33,9 +33,9 @@ #import #import #import +#import #import #import -#import #import #import #import diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 0e548f872a308a..cd14933a3caee7 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -77,11 +77,11 @@ - (void)failSubscribers:(dispatch_queue_t)queue completion:(void (^)(void))compl @end #endif -@interface MTRDeviceTestPairingDelegate : NSObject +@interface MTRDeviceTestDeviceControllerDelegate : NSObject @property (nonatomic, strong) XCTestExpectation * expectation; @end -@implementation MTRDeviceTestPairingDelegate +@implementation MTRDeviceTestDeviceControllerDelegate - (id)initWithExpectation:(XCTestExpectation *)expectation { self = [super init]; @@ -163,10 +163,11 @@ - (void)initStack sController = controller; - MTRDeviceTestPairingDelegate * pairing = [[MTRDeviceTestPairingDelegate alloc] initWithExpectation:expectation]; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.pairing", DISPATCH_QUEUE_SERIAL); + MTRDeviceTestDeviceControllerDelegate * deviceControllerDelegate = + [[MTRDeviceTestDeviceControllerDelegate alloc] initWithExpectation:expectation]; + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.device_controller_delegate", DISPATCH_QUEUE_SERIAL); - [controller setPairingDelegate:pairing queue:callbackQueue]; + [controller setDeviceControllerDelegate:deviceControllerDelegate queue:callbackQueue]; NSError * error; __auto_type * payload = [MTRSetupPayload setupPayloadWithOnboardingPayload:kOnboardingPayload error:&error]; diff --git a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m index 92ff0ec9133dfd..0c285aba126fb7 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m @@ -384,11 +384,11 @@ - (void)readAttributeCacheWithController:(id _Nullable)controller return mConnectedDevice; } -@interface MTRRemoteDeviceSampleTestPairingDelegate : NSObject +@interface MTRRemoteDeviceSampleTestDeviceControllerDelegate : NSObject @property (nonatomic, strong) XCTestExpectation * expectation; @end -@implementation MTRRemoteDeviceSampleTestPairingDelegate +@implementation MTRRemoteDeviceSampleTestDeviceControllerDelegate - (id)initWithExpectation:(XCTestExpectation *)expectation { self = [super init]; @@ -473,11 +473,11 @@ - (void)initStack sController = controller; - MTRRemoteDeviceSampleTestPairingDelegate * pairing = - [[MTRRemoteDeviceSampleTestPairingDelegate alloc] initWithExpectation:expectation]; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.pairing", DISPATCH_QUEUE_SERIAL); + MTRRemoteDeviceSampleTestDeviceControllerDelegate * deviceControllerDelegate = + [[MTRRemoteDeviceSampleTestDeviceControllerDelegate alloc] initWithExpectation:expectation]; + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.device_controller_delegate", DISPATCH_QUEUE_SERIAL); - [controller setPairingDelegate:pairing queue:callbackQueue]; + [controller setDeviceControllerDelegate:deviceControllerDelegate queue:callbackQueue]; __auto_type * payload = [MTRSetupPayload setupPayloadWithOnboardingPayload:kOnboardingPayload error:&error]; XCTAssertNotNil(payload); diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 8b44d5f39639dc..051bda23615430 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -29,9 +29,9 @@ 2C8C8FC0253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C8C8FBD253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.h */; }; 2C8C8FC1253E0C2100797F05 /* MTRStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C8C8FBE253E0C2100797F05 /* MTRStorage.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2C8C8FC2253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2C8C8FBF253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.mm */; }; - 2CB7163B252E8A7B0026E2BB /* MTRDevicePairingDelegateBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CB71638252E8A7B0026E2BB /* MTRDevicePairingDelegateBridge.h */; }; - 2CB7163C252E8A7C0026E2BB /* MTRDevicePairingDelegateBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2CB71639252E8A7B0026E2BB /* MTRDevicePairingDelegateBridge.mm */; }; - 2CB7163F252F731E0026E2BB /* MTRDevicePairingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CB7163E252F731E0026E2BB /* MTRDevicePairingDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2CB7163B252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CB71638252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h */; }; + 2CB7163C252E8A7C0026E2BB /* MTRDeviceControllerDelegateBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2CB71639252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.mm */; }; + 2CB7163F252F731E0026E2BB /* MTRDeviceControllerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CB7163E252F731E0026E2BB /* MTRDeviceControllerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2FD775552695557E00FF4B12 /* error-mapping.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FD775542695557E00FF4B12 /* error-mapping.cpp */; }; 3CF134A7289D8ADA0017A19E /* MTRCSRInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CF134A6289D8AD90017A19E /* MTRCSRInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3CF134A9289D8D800017A19E /* MTRCSRInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CF134A8289D8D800017A19E /* MTRCSRInfo.m */; }; @@ -168,9 +168,9 @@ 2C8C8FBD253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRPersistentStorageDelegateBridge.h; sourceTree = ""; }; 2C8C8FBE253E0C2100797F05 /* MTRStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRStorage.h; sourceTree = ""; }; 2C8C8FBF253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRPersistentStorageDelegateBridge.mm; sourceTree = ""; }; - 2CB71638252E8A7B0026E2BB /* MTRDevicePairingDelegateBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDevicePairingDelegateBridge.h; sourceTree = ""; }; - 2CB71639252E8A7B0026E2BB /* MTRDevicePairingDelegateBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDevicePairingDelegateBridge.mm; sourceTree = ""; }; - 2CB7163E252F731E0026E2BB /* MTRDevicePairingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDevicePairingDelegate.h; sourceTree = ""; }; + 2CB71638252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerDelegateBridge.h; sourceTree = ""; }; + 2CB71639252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceControllerDelegateBridge.mm; sourceTree = ""; }; + 2CB7163E252F731E0026E2BB /* MTRDeviceControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerDelegate.h; sourceTree = ""; }; 2FD775542695557E00FF4B12 /* error-mapping.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "error-mapping.cpp"; path = "../../../app/util/error-mapping.cpp"; sourceTree = ""; }; 3CF134A6289D8AD90017A19E /* MTRCSRInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCSRInfo.h; sourceTree = ""; }; 3CF134A8289D8D800017A19E /* MTRCSRInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTRCSRInfo.m; sourceTree = ""; }; @@ -398,9 +398,9 @@ 2C8C8FBF253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.mm */, 99D466E02798936D0089A18F /* MTRCommissioningParameters.h */, 99AECC7F2798A57E00B6355B /* MTRCommissioningParameters.m */, - 2CB7163E252F731E0026E2BB /* MTRDevicePairingDelegate.h */, - 2CB71638252E8A7B0026E2BB /* MTRDevicePairingDelegateBridge.h */, - 2CB71639252E8A7B0026E2BB /* MTRDevicePairingDelegateBridge.mm */, + 2CB7163E252F731E0026E2BB /* MTRDeviceControllerDelegate.h */, + 2CB71638252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h */, + 2CB71639252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.mm */, AF1CB86D2874B03B00865A96 /* MTROTAProviderDelegate.h */, AF1CB86F2874B04C00865A96 /* MTROTAProviderDelegateBridge.h */, AF5F90FE2878D351005503FA /* MTROTAProviderDelegateBridge.mm */, @@ -501,7 +501,7 @@ 5A6FEC9927B5C88900F25F42 /* MTRDeviceOverXPC.h in Headers */, 51B22C222740CB1D008D5055 /* MTRCommandPayloadsObjc.h in Headers */, 51B22C1E2740CB0A008D5055 /* MTRStructsObjc.h in Headers */, - 2CB7163B252E8A7B0026E2BB /* MTRDevicePairingDelegateBridge.h in Headers */, + 2CB7163B252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h in Headers */, 5ACDDD7A27CD129700EFD68A /* MTRAttributeCacheContainer.h in Headers */, 5A6FEC9227B5669C00F25F42 /* MTRDeviceControllerOverXPC.h in Headers */, 2C1B027B2641DB4E00780EF1 /* MTROperationalCredentialsDelegate.h in Headers */, @@ -512,7 +512,7 @@ 7534F12928BFF20300390851 /* MTRDeviceAttestationDelegate_Internal.h in Headers */, D4772A46285AE98400383630 /* MTRClusterConstants.h in Headers */, 513DDB862761F69300DAA01A /* MTRAttributeTLVValueDecoder_Internal.h in Headers */, - 2CB7163F252F731E0026E2BB /* MTRDevicePairingDelegate.h in Headers */, + 2CB7163F252F731E0026E2BB /* MTRDeviceControllerDelegate.h in Headers */, 88EBF8CE27FABDD500686BC1 /* MTRDeviceAttestationDelegate.h in Headers */, 2C222AD0255C620600E446B9 /* MTRBaseDevice.h in Headers */, 7596A84F2877E6A9004DAE0E /* MTRCluster_internal.h in Headers */, @@ -682,7 +682,7 @@ files = ( 2C8C8FC2253E0C2100797F05 /* MTRPersistentStorageDelegateBridge.mm in Sources */, 99AECC802798A57F00B6355B /* MTRCommissioningParameters.m in Sources */, - 2CB7163C252E8A7C0026E2BB /* MTRDevicePairingDelegateBridge.mm in Sources */, + 2CB7163C252E8A7C0026E2BB /* MTRDeviceControllerDelegateBridge.mm in Sources */, 997DED162695343400975E97 /* MTRThreadOperationalDataset.mm in Sources */, 515C1C6F284F9FFB00A48F0C /* MTRMemory.mm in Sources */, 27A53C1827FBC6920053F131 /* MTRAttestationTrustStoreBridge.mm in Sources */,