From 65fe2d49df76816c14d73579a83980dea3bdf985 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Fri, 17 Mar 2023 12:08:13 +0900 Subject: [PATCH 01/30] Implement commissioning event callback api --- .../CHIP/MTRDeviceControllerDelegate.h | 4 +++ .../CHIP/MTRDeviceControllerDelegateBridge.h | 3 ++ .../CHIP/MTRDeviceControllerDelegateBridge.mm | 29 +++++++++++++++++++ .../CHIPTests/MTRXPCListenerSampleTests.m | 14 +++++++++ 4 files changed, 50 insertions(+) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index c0aadb81e28690..b280b6e18a2dbd 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -53,6 +53,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error; +- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error + deviceId:(NSNumber * _Nullable)deviceId; + +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info; @end typedef NS_ENUM(NSUInteger, MTRPairingStatus) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.h index 464f0c91093d8d..d13331f46bd2ac 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.h @@ -18,6 +18,7 @@ #import "MTRDeviceControllerDelegate.h" #include +#include #include NS_ASSUME_NONNULL_BEGIN @@ -37,6 +38,8 @@ class MTRDeviceControllerDelegateBridge : public chip::Controller::DevicePairing void OnPairingDeleted(CHIP_ERROR error) override; + void OnReadCommissioningInfo(const chip::Controller::ReadCommissioningInfo & info) override; + void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR error) override; private: diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 59d18882e536c4..5fca61a31dd040 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -94,6 +94,27 @@ // This is never actually called; just do nothing. } +void MTRDeviceControllerDelegateBridge::OnReadCommissioningInfo(const chip::Controller::ReadCommissioningInfo & info) +{ + chip::VendorId vendorId = info.basic.vendorId; + uint16_t productId = info.basic.productId; + chip::EndpointId wifiEndpointId = info.network.wifi.endpoint; + chip::EndpointId threadEndpointId = info.network.thread.endpoint; + + MTR_LOG_DEFAULT("DeviceControllerDelegate Read Commissioning Info. VendorId %u ProductId %u", vendorId, productId); + + id strongDelegate = mDelegate; + MTRDeviceController * strongController = mController; + if (strongDelegate && mQueue && strongController) { + if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { + dispatch_async(mQueue, ^{ + NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], @"vendorID", [NSNumber numberWithUnsignedShort:productId], @"productID", [NSNumber numberWithUnsignedShort:wifiEndpointId], @"wifiEndpointID", [NSNumber numberWithUnsignedShort:threadEndpointId], @"threadEndpointIDiitittidf", nil]; + [strongDelegate controller:strongController readCommissioningInfo:info]; + }); + } + } +} + void MTRDeviceControllerDelegateBridge::OnCommissioningComplete(chip::NodeId nodeId, CHIP_ERROR error) { MTR_LOG_DEFAULT("DeviceControllerDelegate Commissioning complete. NodeId %llu Status %s", nodeId, chip::ErrorStr(error)); @@ -107,5 +128,13 @@ [strongDelegate controller:strongController commissioningComplete:nsError]; }); } + + if ([strongDelegate respondsToSelector:@selector(controller:commissioningComplete:deviceId:)]) { + dispatch_async(mQueue, ^{ + NSError * nsError = [MTRError errorForCHIPErrorCode:error]; + NSNumber * deviceId = [NSNumber numberWithUnsignedLongLong:nodeId]; + [strongDelegate controller:strongController commissioningComplete:nsError deviceId:deviceId]; + }); + } } } diff --git a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m index 15131ffd3027ba..9014324c676759 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m @@ -438,6 +438,20 @@ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSEr _expectation = nil; } +- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error + deviceId:(NSNumber * _Nullable)deviceId +{ + XCTAssertEqual(error.code, 0); + [_expectation fulfill]; + _expectation = nil; +} + +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info +{ + [_expectation fulfill]; + _expectation = nil; +} + @end @interface MTRXPCListenerSampleTests : XCTestCase From 55c2b73179cdd7f2e075be0628560deebdf09773 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Fri, 17 Mar 2023 12:15:00 +0900 Subject: [PATCH 02/30] restyle --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 5 +++-- .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 5 ++++- src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m | 5 ++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index b280b6e18a2dbd..b44c6052abfc52 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -53,8 +53,9 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error; -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error - deviceId:(NSNumber * _Nullable)deviceId; +- (void)controller:(MTRDeviceController *)controller + commissioningComplete:(NSError * _Nullable)error + deviceId:(NSNumber * _Nullable)deviceId; - (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info; @end diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 5fca61a31dd040..b026ddcf0b82bf 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -108,7 +108,10 @@ if (strongDelegate && mQueue && strongController) { if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ - NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], @"vendorID", [NSNumber numberWithUnsignedShort:productId], @"productID", [NSNumber numberWithUnsignedShort:wifiEndpointId], @"wifiEndpointID", [NSNumber numberWithUnsignedShort:threadEndpointId], @"threadEndpointIDiitittidf", nil]; + NSDictionary * info = [NSDictionary + dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], @"vendorID", + [NSNumber numberWithUnsignedShort:productId], @"productID", [NSNumber numberWithUnsignedShort:wifiEndpointId], + @"wifiEndpointID", [NSNumber numberWithUnsignedShort:threadEndpointId], @"threadEndpointIDiitittidf", nil]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); } diff --git a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m index 9014324c676759..f628fb5215faef 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m @@ -438,15 +438,14 @@ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSEr _expectation = nil; } -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error - deviceId:(NSNumber * _Nullable)deviceId +- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error deviceId:(NSNumber * _Nullable)deviceId { XCTAssertEqual(error.code, 0); [_expectation fulfill]; _expectation = nil; } -- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info { [_expectation fulfill]; _expectation = nil; From e13d8438d1a32520f37f5e14441b526f0b52e152 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Sat, 25 Mar 2023 16:44:14 +0900 Subject: [PATCH 03/30] Add comment, fix typo --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 7 +++++++ .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 49b898891eff74..f9f5a10b894f1b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -54,10 +54,17 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error; +/** + * Notify the delegate when commissioning is completed. + * For getting commissioning controllee's deviceId + */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error deviceId:(NSNumber * _Nullable)deviceId; +/** + * Notify the delegate when read commissioning Infomation. (vendorID, productID) + */ - (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info; @end diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index b026ddcf0b82bf..c1e5cb171bc8b5 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -111,7 +111,7 @@ NSDictionary * info = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], @"vendorID", [NSNumber numberWithUnsignedShort:productId], @"productID", [NSNumber numberWithUnsignedShort:wifiEndpointId], - @"wifiEndpointID", [NSNumber numberWithUnsignedShort:threadEndpointId], @"threadEndpointIDiitittidf", nil]; + @"wifiEndpointID", [NSNumber numberWithUnsignedShort:threadEndpointId], @"threadEndpointID", nil]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); } From 0015b4e4a0748fbff80bb1a437e2e417c7a2d9ab Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Sun, 26 Mar 2023 16:41:22 +0900 Subject: [PATCH 04/30] Modify from comment --- .../Framework/CHIP/MTRDeviceControllerDelegate.h | 1 + .../Framework/CHIPTests/MTRXPCListenerSampleTests.m | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index f9f5a10b894f1b..70b0e21a2bd20f 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -64,6 +64,7 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) /** * Notify the delegate when read commissioning Infomation. (vendorID, productID) + * Key : vendorID, productID, wifiEndpointID (device's Wi-Fi suport or not), threadEndpointID (device's Thread support or not) */ - (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info; @end diff --git a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m index bb76b65a0dc582..0880a7ba08996c 100644 --- a/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m @@ -439,19 +439,6 @@ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSEr _expectation = nil; } -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error deviceId:(NSNumber * _Nullable)deviceId -{ - XCTAssertEqual(error.code, 0); - [_expectation fulfill]; - _expectation = nil; -} - -- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info -{ - [_expectation fulfill]; - _expectation = nil; -} - @end @interface MTRXPCListenerSampleTests : XCTestCase From 5963cfab28d4abebb6b97007e99a968bfa7d1a8c Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Fri, 7 Apr 2023 13:35:22 +0900 Subject: [PATCH 05/30] Update after review --- .../QRCode/QRCodeViewController.h | 2 +- .../QRCode/QRCodeViewController.m | 23 +++++++++++++------ .../CHIP/MTRDeviceControllerDelegate.h | 15 +++++++----- .../CHIP/MTRDeviceControllerDelegateBridge.mm | 21 +++++++++-------- 4 files changed, 38 insertions(+), 23 deletions(-) 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 2105bec3b20545..ab8cdaf939f9b3 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -408,7 +408,7 @@ - (void)viewDidLoad dispatch_queue_t callbackQueue = dispatch_queue_create("com.csa.matter.qrcodevc.callback", DISPATCH_QUEUE_SERIAL); self.chipController = InitializeMTR(); - [self.chipController setPairingDelegate:self queue:callbackQueue]; + [self.chipController setDeviceControllerDelegate:self queue:callbackQueue]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard)]; [self.view addGestureRecognizer:tap]; @@ -478,8 +478,8 @@ - (void)setVendorIDOnAccessory } } -// MARK: MTRDevicePairingDelegate -- (void)onPairingComplete:(NSError * _Nullable)error +// MARK: MTRDeviceControllerDelegate +- (void)controller:(MTRDeviceController *)controller commissioningSessionEstablishmentDone:(NSError *)error { if (error != nil) { NSLog(@"Got pairing error back %@", error); @@ -672,18 +672,27 @@ - (void)commissionWithSSID:(NSString *)ssid password:(NSString *)password } } -- (void)onCommissioningComplete:(NSError * _Nullable)error +// MARK: MTRDeviceControllerDelegate +- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error + deviceId:(NSNumber *)deviceId { if (error != nil) { NSLog(@"Error retrieving device informations over Mdns: %@", error); return; } // track this device - uint64_t deviceId = MTRGetNextAvailableDeviceID() - 1; - MTRSetDevicePaired(deviceId, YES); + MTRSetDevicePaired([deviceId unsignedLongLongValue], YES); [self setVendorIDOnAccessory]; } +// MARK: MTRDeviceControllerDelegate +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary *)info +{ + NSNumber *vendorID = info[MTRVendorIDKey]; + NSNumber *productID = info[MTRProductIDKey]; + NSLog(@"readCommissioningInfo, vendorID:%@, productID:%@", vendorID, productID); +} + - (void)updateUIFields:(MTRSetupPayload *)payload rawPayload:(nullable NSString *)rawPayload isManualCode:(BOOL)isManualCode { if (isManualCode) { @@ -789,7 +798,7 @@ - (void)_restartMatterStack { self.chipController = MTRRestartController(self.chipController); dispatch_queue_t callbackQueue = dispatch_queue_create("com.csa.matter.qrcodevc.callback", DISPATCH_QUEUE_SERIAL); - [self.chipController setPairingDelegate:self queue:callbackQueue]; + [self.chipController setDeviceControllerDelegate:self queue:callbackQueue]; } - (void)handleRendezVousDefault:(NSString *)payload diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 70b0e21a2bd20f..fe8a2a13a72b0a 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -28,6 +28,9 @@ typedef NS_ENUM(NSInteger, MTRCommissioningStatus) { = 3, } API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +extern NSString * const MTRVendorIDKey; +extern NSString * const MTRProductIDKey; + @class MTRDeviceController; /** @@ -52,21 +55,21 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) /** * Notify the delegate when commissioning is completed. */ -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error; - +- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error +MTR_NEWLY_DEPRECATED("Please use commissioningComplete:deviceId"); /** * Notify the delegate when commissioning is completed. * For getting commissioning controllee's deviceId */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error - deviceId:(NSNumber * _Nullable)deviceId; - + deviceId:(NSNumber * _Nullable)deviceId MTR_NEWLY_AVAILABLE; /** * Notify the delegate when read commissioning Infomation. (vendorID, productID) - * Key : vendorID, productID, wifiEndpointID (device's Wi-Fi suport or not), threadEndpointID (device's Thread support or not) + * This value transmits the unproven value stored in the Basic Information Cluster in Controllee. + * The proof of the value is made during the Device Attestation step. */ -- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info; +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info MTR_NEWLY_AVAILABLE; @end typedef NS_ENUM(NSUInteger, MTRPairingStatus) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index c1e5cb171bc8b5..e3862bc6431a6c 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -20,6 +20,9 @@ #import "MTRError_Internal.h" #import "MTRLogging_Internal.h" +NSString * const MTRVendorIDKey = @"vendorID"; +NSString * const MTRProductIDKey = @"productID"; + MTRDeviceControllerDelegateBridge::MTRDeviceControllerDelegateBridge(void) : mDelegate(nil) { @@ -109,9 +112,8 @@ if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ NSDictionary * info = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], @"vendorID", - [NSNumber numberWithUnsignedShort:productId], @"productID", [NSNumber numberWithUnsignedShort:wifiEndpointId], - @"wifiEndpointID", [NSNumber numberWithUnsignedShort:threadEndpointId], @"threadEndpointID", nil]; + dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], MTRVendorIDKey, + [NSNumber numberWithUnsignedShort:productId], MTRProductIDKey, nil]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); } @@ -125,18 +127,19 @@ id strongDelegate = mDelegate; MTRDeviceController * strongController = mController; if (strongDelegate && mQueue && strongController) { - if ([strongDelegate respondsToSelector:@selector(controller:commissioningComplete:)]) { + if ([strongDelegate respondsToSelector:@selector(controller:commissioningComplete:deviceId:)]) { dispatch_async(mQueue, ^{ NSError * nsError = [MTRError errorForCHIPErrorCode:error]; - [strongDelegate controller:strongController commissioningComplete:nsError]; + NSNumber * deviceId = [NSNumber numberWithUnsignedLongLong:nodeId]; + [strongDelegate controller:strongController commissioningComplete:nsError deviceId:deviceId]; }); + return; } - - if ([strongDelegate respondsToSelector:@selector(controller:commissioningComplete:deviceId:)]) { + // If only the DEPRECATED function is defined + if ([strongDelegate respondsToSelector:@selector(controller:commissioningComplete:)]) { dispatch_async(mQueue, ^{ NSError * nsError = [MTRError errorForCHIPErrorCode:error]; - NSNumber * deviceId = [NSNumber numberWithUnsignedLongLong:nodeId]; - [strongDelegate controller:strongController commissioningComplete:nsError deviceId:deviceId]; + [strongDelegate controller:strongController commissioningComplete:nsError]; }); } } From 245ae3424d8f789795d1796f09188e9441e40ae7 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Fri, 7 Apr 2023 16:33:19 +0900 Subject: [PATCH 06/30] restyle --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 7 ++++--- .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index fe8a2a13a72b0a..e80abd7ea5ae2d 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -55,8 +55,8 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) /** * Notify the delegate when commissioning is completed. */ -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error -MTR_NEWLY_DEPRECATED("Please use commissioningComplete:deviceId"); +- (void)controller:(MTRDeviceController *)controller + commissioningComplete:(NSError * _Nullable)error MTR_NEWLY_DEPRECATED("Please use commissioningComplete:deviceId"); /** * Notify the delegate when commissioning is completed. * For getting commissioning controllee's deviceId @@ -69,7 +69,8 @@ MTR_NEWLY_DEPRECATED("Please use commissioningComplete:deviceId"); * This value transmits the unproven value stored in the Basic Information Cluster in Controllee. * The proof of the value is made during the Device Attestation step. */ -- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info MTR_NEWLY_AVAILABLE; +- (void)controller:(MTRDeviceController *)controller + readCommissioningInfo:(NSDictionary * _Nullable)info MTR_NEWLY_AVAILABLE; @end typedef NS_ENUM(NSUInteger, MTRPairingStatus) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index e3862bc6431a6c..a8ad94538cea9a 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -111,9 +111,9 @@ if (strongDelegate && mQueue && strongController) { if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ - NSDictionary * info = [NSDictionary - dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], MTRVendorIDKey, - [NSNumber numberWithUnsignedShort:productId], MTRProductIDKey, nil]; + NSDictionary * info = + [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], MTRVendorIDKey, + [NSNumber numberWithUnsignedShort:productId], MTRProductIDKey, nil]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); } From 219fd19e596afc8ea90ebe108e2dccdd903cdfdb Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Sat, 8 Apr 2023 09:45:06 +0900 Subject: [PATCH 07/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index e80abd7ea5ae2d..cee33d439a914f 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -57,6 +57,7 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error MTR_NEWLY_DEPRECATED("Please use commissioningComplete:deviceId"); + /** * Notify the delegate when commissioning is completed. * For getting commissioning controllee's deviceId From fa33adb7dcda5b4194f3c0219910a53272013dd5 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Sat, 8 Apr 2023 09:45:20 +0900 Subject: [PATCH 08/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index cee33d439a914f..a88d87dbd2e035 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -64,7 +64,7 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error - deviceId:(NSNumber * _Nullable)deviceId MTR_NEWLY_AVAILABLE; + nodeID:(NSNumber * _Nullable)nodeID MTR_NEWLY_AVAILABLE; /** * Notify the delegate when read commissioning Infomation. (vendorID, productID) * This value transmits the unproven value stored in the Basic Information Cluster in Controllee. From 30466b08ffb3d71e86fa9662f7b5369857435418 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Sat, 8 Apr 2023 09:45:32 +0900 Subject: [PATCH 09/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index a88d87dbd2e035..4e607d84e156ba 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -66,9 +66,11 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) commissioningComplete:(NSError * _Nullable)error nodeID:(NSNumber * _Nullable)nodeID MTR_NEWLY_AVAILABLE; /** - * Notify the delegate when read commissioning Infomation. (vendorID, productID) - * This value transmits the unproven value stored in the Basic Information Cluster in Controllee. - * The proof of the value is made during the Device Attestation step. + * Notify the delegate when commissioning infomation has been read from the Basic + * Information cluster of the commissionee. + * + * At the point when this notification happens, device attestation has not been performed yet, + * so the information delivered by this notification should not be trusted. */ - (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary * _Nullable)info MTR_NEWLY_AVAILABLE; From 53aa9d2c9a3ea502302ed2b72ef3f6c63027710f Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Sun, 9 Apr 2023 15:25:30 +0900 Subject: [PATCH 10/30] Change Variable name(nodeID) remove ununsed code --- .../View Controllers/QRCode/QRCodeViewController.m | 4 ++-- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 6 +++--- .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 8 +++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index ab8cdaf939f9b3..9c162c60711b78 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -674,14 +674,14 @@ - (void)commissionWithSSID:(NSString *)ssid password:(NSString *)password // MARK: MTRDeviceControllerDelegate - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error - deviceId:(NSNumber *)deviceId + nodeID:(NSNumber *)nodeID { if (error != nil) { NSLog(@"Error retrieving device informations over Mdns: %@", error); return; } // track this device - MTRSetDevicePaired([deviceId unsignedLongLongValue], YES); + MTRSetDevicePaired([nodeID unsignedLongLongValue], YES); [self setVendorIDOnAccessory]; } diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 4e607d84e156ba..8a1cfa6e7e4c35 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -56,15 +56,15 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) * Notify the delegate when commissioning is completed. */ - (void)controller:(MTRDeviceController *)controller - commissioningComplete:(NSError * _Nullable)error MTR_NEWLY_DEPRECATED("Please use commissioningComplete:deviceId"); + commissioningComplete:(NSError * _Nullable)error MTR_NEWLY_DEPRECATED("Please use commissioningComplete:nodeID"); /** * Notify the delegate when commissioning is completed. - * For getting commissioning controllee's deviceId + * For getting commissioning controllee's nodeID */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error - nodeID:(NSNumber * _Nullable)nodeID MTR_NEWLY_AVAILABLE; + nodeID:(NSNumber * _Nonnull)nodeID MTR_NEWLY_AVAILABLE; /** * Notify the delegate when commissioning infomation has been read from the Basic * Information cluster of the commissionee. diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index a8ad94538cea9a..c342aa5dc68caa 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -101,8 +101,6 @@ { chip::VendorId vendorId = info.basic.vendorId; uint16_t productId = info.basic.productId; - chip::EndpointId wifiEndpointId = info.network.wifi.endpoint; - chip::EndpointId threadEndpointId = info.network.thread.endpoint; MTR_LOG_DEFAULT("DeviceControllerDelegate Read Commissioning Info. VendorId %u ProductId %u", vendorId, productId); @@ -127,11 +125,11 @@ id strongDelegate = mDelegate; MTRDeviceController * strongController = mController; if (strongDelegate && mQueue && strongController) { - if ([strongDelegate respondsToSelector:@selector(controller:commissioningComplete:deviceId:)]) { + if ([strongDelegate respondsToSelector:@selector(controller:commissioningComplete:nodeID:)]) { dispatch_async(mQueue, ^{ NSError * nsError = [MTRError errorForCHIPErrorCode:error]; - NSNumber * deviceId = [NSNumber numberWithUnsignedLongLong:nodeId]; - [strongDelegate controller:strongController commissioningComplete:nsError deviceId:deviceId]; + NSNumber * nodeID = [NSNumber numberWithUnsignedLongLong:nodeId]; + [strongDelegate controller:strongController commissioningComplete:nsError nodeID:nodeID]; }); return; } From dea007b81cc0092351edf06e9f5bcbd8b73f4ebb Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Sun, 9 Apr 2023 16:29:30 +0900 Subject: [PATCH 11/30] Modify readCommissioningInfo to interface --- .../QRCode/QRCodeViewController.m | 6 ++--- .../CHIP/MTRDeviceControllerDelegate.h | 23 ++++++++++++++++--- .../CHIP/MTRDeviceControllerDelegateBridge.mm | 20 +++++++++++----- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index 9c162c60711b78..cb92a6654e6304 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -686,11 +686,9 @@ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSEr } // MARK: MTRDeviceControllerDelegate -- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(NSDictionary *)info +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(MTRReadCommissioningInfo *)info { - NSNumber *vendorID = info[MTRVendorIDKey]; - NSNumber *productID = info[MTRProductIDKey]; - NSLog(@"readCommissioningInfo, vendorID:%@, productID:%@", vendorID, productID); + NSLog(@"readCommissioningInfo, vendorID:%@, productID:%@", info.vendorID, info.productID); } - (void)updateUIFields:(MTRSetupPayload *)payload rawPayload:(nullable NSString *)rawPayload isManualCode:(BOOL)isManualCode diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 8a1cfa6e7e4c35..ed9681335bc3bf 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -28,8 +28,25 @@ typedef NS_ENUM(NSInteger, MTRCommissioningStatus) { = 3, } API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); -extern NSString * const MTRVendorIDKey; -extern NSString * const MTRProductIDKey; +/** + * Read from controllee's Information at Commissioning + */ +MTR_NEWLY_AVAILABLE +@interface MTRReadCommissioningInfo : NSObject + +/** + * Controllee's VendorID Attribute of Basic Information cluster + */ +@property (nonatomic, copy, readonly, nonnull) NSNumber * vendorID MTR_NEWLY_AVAILABLE; + +/** + * Controllee's ProductID Attribute of Basic Information cluster + */ +@property (nonatomic, copy, readonly, nonnull) NSNumber * productID MTR_NEWLY_AVAILABLE; + +- (instancetype)initWithVendorID:(NSNumber * _Nonnull)vendorID + productID:(NSNumber * _Nonnull)productID; +@end @class MTRDeviceController; @@ -73,7 +90,7 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) * so the information delivered by this notification should not be trusted. */ - (void)controller:(MTRDeviceController *)controller - readCommissioningInfo:(NSDictionary * _Nullable)info MTR_NEWLY_AVAILABLE; + readCommissioningInfo:(MTRReadCommissioningInfo *)info MTR_NEWLY_AVAILABLE; @end typedef NS_ENUM(NSUInteger, MTRPairingStatus) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index c342aa5dc68caa..34cf14df40101d 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -20,9 +20,6 @@ #import "MTRError_Internal.h" #import "MTRLogging_Internal.h" -NSString * const MTRVendorIDKey = @"vendorID"; -NSString * const MTRProductIDKey = @"productID"; - MTRDeviceControllerDelegateBridge::MTRDeviceControllerDelegateBridge(void) : mDelegate(nil) { @@ -109,9 +106,7 @@ if (strongDelegate && mQueue && strongController) { if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ - NSDictionary * info = - [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:vendorId], MTRVendorIDKey, - [NSNumber numberWithUnsignedShort:productId], MTRProductIDKey, nil]; + __auto_type * info = [[MTRReadCommissioningInfo alloc] initWithVendorID:[NSNumber numberWithUnsignedShort:vendorId] productID:[NSNumber numberWithUnsignedShort:productId]]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); } @@ -142,3 +137,16 @@ } } } + +@implementation MTRReadCommissioningInfo + +- (instancetype)initWithVendorID:(NSNumber *)vendorID productID:(NSNumber *)productID +{ + if (self = [super init]) { + _vendorID = vendorID; + _productID = productID; + } + return self; +} + +@end From aa4c86674028e95bc4ed6319388c8dff75622943 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Sun, 9 Apr 2023 16:34:08 +0900 Subject: [PATCH 12/30] restyle --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 6 ++---- .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index ed9681335bc3bf..212112c5c23f51 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -44,8 +44,7 @@ MTR_NEWLY_AVAILABLE */ @property (nonatomic, copy, readonly, nonnull) NSNumber * productID MTR_NEWLY_AVAILABLE; -- (instancetype)initWithVendorID:(NSNumber * _Nonnull)vendorID - productID:(NSNumber * _Nonnull)productID; +- (instancetype)initWithVendorID:(NSNumber * _Nonnull)vendorID productID:(NSNumber * _Nonnull)productID; @end @class MTRDeviceController; @@ -89,8 +88,7 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) * At the point when this notification happens, device attestation has not been performed yet, * so the information delivered by this notification should not be trusted. */ -- (void)controller:(MTRDeviceController *)controller - readCommissioningInfo:(MTRReadCommissioningInfo *)info MTR_NEWLY_AVAILABLE; +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(MTRReadCommissioningInfo *)info MTR_NEWLY_AVAILABLE; @end typedef NS_ENUM(NSUInteger, MTRPairingStatus) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 34cf14df40101d..1ea5348c8b1c0c 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -106,7 +106,9 @@ if (strongDelegate && mQueue && strongController) { if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ - __auto_type * info = [[MTRReadCommissioningInfo alloc] initWithVendorID:[NSNumber numberWithUnsignedShort:vendorId] productID:[NSNumber numberWithUnsignedShort:productId]]; + __auto_type * info = + [[MTRReadCommissioningInfo alloc] initWithVendorID:[NSNumber numberWithUnsignedShort:vendorId] + productID:[NSNumber numberWithUnsignedShort:productId]]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); } From 1f65c3be0656dbe11ee69e98885c76251b2c630b Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Sun, 9 Apr 2023 16:42:18 +0900 Subject: [PATCH 13/30] restyle-2 --- .../CHIPTool/View Controllers/QRCode/QRCodeViewController.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index cb92a6654e6304..a5f3c6c90c9f38 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -673,8 +673,7 @@ - (void)commissionWithSSID:(NSString *)ssid password:(NSString *)password } // MARK: MTRDeviceControllerDelegate -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error - nodeID:(NSNumber *)nodeID +- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error nodeID:(NSNumber *)nodeID { if (error != nil) { NSLog(@"Error retrieving device informations over Mdns: %@", error); From 8f1b610dad92aaf92c80fa8844770f08cacd92f8 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Tue, 25 Apr 2023 10:54:57 +0900 Subject: [PATCH 14/30] Modify nodeID error check --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 4 +++- .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 212112c5c23f51..5f51740ce646b8 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -77,10 +77,12 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) /** * Notify the delegate when commissioning is completed. * For getting commissioning controllee's nodeID + * + * NodeID is nil if commissioning is failed. */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error - nodeID:(NSNumber * _Nonnull)nodeID MTR_NEWLY_AVAILABLE; + nodeID:(NSNumber * _Nullable)nodeID MTR_NEWLY_AVAILABLE; /** * Notify the delegate when commissioning infomation has been read from the Basic * Information cluster of the commissionee. diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 1ea5348c8b1c0c..203005fbca1351 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -125,7 +125,10 @@ if ([strongDelegate respondsToSelector:@selector(controller:commissioningComplete:nodeID:)]) { dispatch_async(mQueue, ^{ NSError * nsError = [MTRError errorForCHIPErrorCode:error]; - NSNumber * nodeID = [NSNumber numberWithUnsignedLongLong:nodeId]; + NSNumber * nodeID = nil; + if (error == CHIP_NO_ERROR) { + nodeID = [NSNumber numberWithUnsignedLongLong:nodeId]; + } [strongDelegate controller:strongController commissioningComplete:nsError nodeID:nodeID]; }); return; From 8dc46fbae29a5e242f70e83c6522cb270d861f63 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Tue, 25 Apr 2023 11:28:11 +0900 Subject: [PATCH 15/30] restyle --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 203005fbca1351..05f2b5c4c53818 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -127,7 +127,7 @@ NSError * nsError = [MTRError errorForCHIPErrorCode:error]; NSNumber * nodeID = nil; if (error == CHIP_NO_ERROR) { - nodeID = [NSNumber numberWithUnsignedLongLong:nodeId]; + nodeID = [NSNumber numberWithUnsignedLongLong:nodeId]; } [strongDelegate controller:strongController commissioningComplete:nsError nodeID:nodeID]; }); From 796640655552b1e87c260f69af173c0ebe427da9 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 07:54:15 +0900 Subject: [PATCH 16/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 5f51740ce646b8..e83e7e03c16463 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -76,9 +76,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) /** * Notify the delegate when commissioning is completed. - * For getting commissioning controllee's nodeID * - * NodeID is nil if commissioning is failed. + * Exactly one of error and nodeID will be nil. + * + * If nodeID is not nil, then it represents the node id the node was assigned, as encoded in its operational certificate. */ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error From fe0347f24eb2b1376bdfcd3abe2604bfb1d1c29a Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 07:54:37 +0900 Subject: [PATCH 17/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index e83e7e03c16463..bfd02fa982e590 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -29,7 +29,7 @@ typedef NS_ENUM(NSInteger, MTRCommissioningStatus) { } API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); /** - * Read from controllee's Information at Commissioning + * A representation of a (vendor, product) pair that identifies a specific product. */ MTR_NEWLY_AVAILABLE @interface MTRReadCommissioningInfo : NSObject From 483429a556fb8d9228f4119833ad8a59dcf02a4a Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 07:54:52 +0900 Subject: [PATCH 18/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 05f2b5c4c53818..90751065487c97 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -106,7 +106,7 @@ if (strongDelegate && mQueue && strongController) { if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ - __auto_type * info = + auto * info = [[MTRReadCommissioningInfo alloc] initWithVendorID:[NSNumber numberWithUnsignedShort:vendorId] productID:[NSNumber numberWithUnsignedShort:productId]]; [strongDelegate controller:strongController readCommissioningInfo:info]; From ebf581146a5fe40c9222b2f331b1571fa002ab7d Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 07:55:13 +0900 Subject: [PATCH 19/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index bfd02fa982e590..2f8bb0bf413706 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -42,7 +42,7 @@ MTR_NEWLY_AVAILABLE /** * Controllee's ProductID Attribute of Basic Information cluster */ -@property (nonatomic, copy, readonly, nonnull) NSNumber * productID MTR_NEWLY_AVAILABLE; +@property (nonatomic, copy, readonly) NSNumber * productID MTR_NEWLY_AVAILABLE; - (instancetype)initWithVendorID:(NSNumber * _Nonnull)vendorID productID:(NSNumber * _Nonnull)productID; @end From a728d5486aa1373454986229fc129c7398f9d87a Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 07:55:40 +0900 Subject: [PATCH 20/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 90751065487c97..9d6bb5f7bcdc0c 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -127,7 +127,7 @@ NSError * nsError = [MTRError errorForCHIPErrorCode:error]; NSNumber * nodeID = nil; if (error == CHIP_NO_ERROR) { - nodeID = [NSNumber numberWithUnsignedLongLong:nodeId]; + nodeID = @(nodeId); } [strongDelegate controller:strongController commissioningComplete:nsError nodeID:nodeID]; }); From 462ea5f3751b3341cff337ec11143579e52dbcfd Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 07:55:49 +0900 Subject: [PATCH 21/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm Co-authored-by: Boris Zbarsky --- .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 9d6bb5f7bcdc0c..68509558b32f9c 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -107,8 +107,8 @@ if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ auto * info = - [[MTRReadCommissioningInfo alloc] initWithVendorID:[NSNumber numberWithUnsignedShort:vendorId] - productID:[NSNumber numberWithUnsignedShort:productId]]; + [[MTRReadCommissioningInfo alloc] initWithVendorID:@(vendorId) + productID:@(productId)]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); } From a802c302a336a2934745db96a6a5cbfd36f3fe6d Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 07:55:58 +0900 Subject: [PATCH 22/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 2f8bb0bf413706..a71271d49e0fb5 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -32,7 +32,7 @@ typedef NS_ENUM(NSInteger, MTRCommissioningStatus) { * A representation of a (vendor, product) pair that identifies a specific product. */ MTR_NEWLY_AVAILABLE -@interface MTRReadCommissioningInfo : NSObject +@interface MTRProductIdentity : NSObject /** * Controllee's VendorID Attribute of Basic Information cluster From 7059d24c1ccf192358df3b108fd141122c3a00d0 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 08:09:13 +0900 Subject: [PATCH 23/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index a71271d49e0fb5..3348d3b2c21719 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -37,7 +37,7 @@ MTR_NEWLY_AVAILABLE /** * Controllee's VendorID Attribute of Basic Information cluster */ -@property (nonatomic, copy, readonly, nonnull) NSNumber * vendorID MTR_NEWLY_AVAILABLE; +@property (nonatomic, copy, readonly) NSNumber * vendorID MTR_NEWLY_AVAILABLE; /** * Controllee's ProductID Attribute of Basic Information cluster From 6cfa4129e37d68cb6c90d81591c1bcc21e71e094 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 26 Apr 2023 08:09:25 +0900 Subject: [PATCH 24/30] Update src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 3348d3b2c21719..9da7d52e060d00 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -44,7 +44,7 @@ MTR_NEWLY_AVAILABLE */ @property (nonatomic, copy, readonly) NSNumber * productID MTR_NEWLY_AVAILABLE; -- (instancetype)initWithVendorID:(NSNumber * _Nonnull)vendorID productID:(NSNumber * _Nonnull)productID; +- (instancetype)initWithVendorID:(NSNumber *)vendorID productID:(NSNumber *)productID; @end @class MTRDeviceController; From e82a92d8dfef137186d16c7bc11a43d8cc836592 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Wed, 26 Apr 2023 08:17:41 +0900 Subject: [PATCH 25/30] modify for changing variable name --- .../CHIPTool/View Controllers/QRCode/QRCodeViewController.m | 4 ++-- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 2 +- .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index a5f3c6c90c9f38..f86bd9c920e3d4 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -673,7 +673,7 @@ - (void)commissionWithSSID:(NSString *)ssid password:(NSString *)password } // MARK: MTRDeviceControllerDelegate -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError *)error nodeID:(NSNumber *)nodeID +- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error nodeID:(NSNumber * _Nullable)nodeID { if (error != nil) { NSLog(@"Error retrieving device informations over Mdns: %@", error); @@ -685,7 +685,7 @@ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSEr } // MARK: MTRDeviceControllerDelegate -- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(MTRReadCommissioningInfo *)info +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(MTRProductIdentity *)info { NSLog(@"readCommissioningInfo, vendorID:%@, productID:%@", info.vendorID, info.productID); } diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index a71271d49e0fb5..73878f20448f6d 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -91,7 +91,7 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) * At the point when this notification happens, device attestation has not been performed yet, * so the information delivered by this notification should not be trusted. */ -- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(MTRReadCommissioningInfo *)info MTR_NEWLY_AVAILABLE; +- (void)controller:(MTRDeviceController *)controller readCommissioningInfo:(MTRProductIdentity *)info MTR_NEWLY_AVAILABLE; @end typedef NS_ENUM(NSUInteger, MTRPairingStatus) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index 68509558b32f9c..cfe1fe3c69fba6 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -107,7 +107,7 @@ if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ auto * info = - [[MTRReadCommissioningInfo alloc] initWithVendorID:@(vendorId) + [[MTRProductIdentity alloc] initWithVendorID:@(vendorId) productID:@(productId)]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); @@ -143,7 +143,7 @@ } } -@implementation MTRReadCommissioningInfo +@implementation MTRProductIdentity - (instancetype)initWithVendorID:(NSNumber *)vendorID productID:(NSNumber *)productID { From 430cb9ff5fd931431d08e8cba4c0ee10e0b8d1b8 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Wed, 26 Apr 2023 08:19:11 +0900 Subject: [PATCH 26/30] restyle --- .../Framework/CHIP/MTRDeviceControllerDelegateBridge.mm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm index cfe1fe3c69fba6..71ca534e67ddff 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegateBridge.mm @@ -106,9 +106,7 @@ if (strongDelegate && mQueue && strongController) { if ([strongDelegate respondsToSelector:@selector(controller:readCommissioningInfo:)]) { dispatch_async(mQueue, ^{ - auto * info = - [[MTRProductIdentity alloc] initWithVendorID:@(vendorId) - productID:@(productId)]; + auto * info = [[MTRProductIdentity alloc] initWithVendorID:@(vendorId) productID:@(productId)]; [strongDelegate controller:strongController readCommissioningInfo:info]; }); } From e5d49b9bf67705cd06bfe1bc51a1e227f59ed606 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Wed, 26 Apr 2023 08:23:56 +0900 Subject: [PATCH 27/30] restyle-2 --- .../CHIPTool/View Controllers/QRCode/QRCodeViewController.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index f86bd9c920e3d4..0ee07833ecc36e 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -673,7 +673,9 @@ - (void)commissionWithSSID:(NSString *)ssid password:(NSString *)password } // MARK: MTRDeviceControllerDelegate -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error nodeID:(NSNumber * _Nullable)nodeID +- (void)controller:(MTRDeviceController *)controller + commissioningComplete:(NSError * _Nullable)error + nodeID:(NSNumber * _Nullable)nodeID { if (error != nil) { NSLog(@"Error retrieving device informations over Mdns: %@", error); From 76665558a3b76b0884a91613ccb385a2a84f9d89 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 26 Apr 2023 01:59:04 -0400 Subject: [PATCH 28/30] Apply suggestions from code review --- .../View Controllers/QRCode/QRCodeViewController.m | 2 +- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index 0ee07833ecc36e..66c2883964932d 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -479,7 +479,7 @@ - (void)setVendorIDOnAccessory } // MARK: MTRDeviceControllerDelegate -- (void)controller:(MTRDeviceController *)controller commissioningSessionEstablishmentDone:(NSError *)error +- (void)controller:(MTRDeviceController *)controller commissioningSessionEstablishmentDone:(NSError * _Nullable)error { if (error != nil) { NSLog(@"Got pairing error back %@", error); diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 5b6162c731e7bd..1387aee6c9a36d 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -34,14 +34,8 @@ typedef NS_ENUM(NSInteger, MTRCommissioningStatus) { MTR_NEWLY_AVAILABLE @interface MTRProductIdentity : NSObject -/** - * Controllee's VendorID Attribute of Basic Information cluster - */ @property (nonatomic, copy, readonly) NSNumber * vendorID MTR_NEWLY_AVAILABLE; -/** - * Controllee's ProductID Attribute of Basic Information cluster - */ @property (nonatomic, copy, readonly) NSNumber * productID MTR_NEWLY_AVAILABLE; - (instancetype)initWithVendorID:(NSNumber *)vendorID productID:(NSNumber *)productID; @@ -84,6 +78,7 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error nodeID:(NSNumber * _Nullable)nodeID MTR_NEWLY_AVAILABLE; + /** * Notify the delegate when commissioning infomation has been read from the Basic * Information cluster of the commissionee. From 2cbc46046874d2428a84c5ec7e741436e9bac403 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 26 Apr 2023 02:03:00 -0400 Subject: [PATCH 29/30] Fix deprecation message. --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 1387aee6c9a36d..4362f060fa8ebb 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -66,7 +66,7 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) * Notify the delegate when commissioning is completed. */ - (void)controller:(MTRDeviceController *)controller - commissioningComplete:(NSError * _Nullable)error MTR_NEWLY_DEPRECATED("Please use commissioningComplete:nodeID"); + commissioningComplete:(NSError * _Nullable)error MTR_NEWLY_DEPRECATED("Please use controller:commissioningComplete:nodeID:"); /** * Notify the delegate when commissioning is completed. From 346f7d67a3b05826ed3989ab98b1c4c152d2fb1f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 26 Apr 2023 02:04:06 -0400 Subject: [PATCH 30/30] Remove redundant availability annotations. --- src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 4362f060fa8ebb..37c2f691307d02 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -34,9 +34,9 @@ typedef NS_ENUM(NSInteger, MTRCommissioningStatus) { MTR_NEWLY_AVAILABLE @interface MTRProductIdentity : NSObject -@property (nonatomic, copy, readonly) NSNumber * vendorID MTR_NEWLY_AVAILABLE; +@property (nonatomic, copy, readonly) NSNumber * vendorID; -@property (nonatomic, copy, readonly) NSNumber * productID MTR_NEWLY_AVAILABLE; +@property (nonatomic, copy, readonly) NSNumber * productID; - (instancetype)initWithVendorID:(NSNumber *)vendorID productID:(NSNumber *)productID; @end