Skip to content

Commit

Permalink
Remove the updateDevice API from the Darwin SDK. (#18543)
Browse files Browse the repository at this point in the history
It's not really well-defined, and there are no non-dead-code
consumers.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Sep 14, 2023
1 parent 492a3ca commit 3450163
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,40 +671,6 @@ - (void)commissionWithSSID:(NSString *)ssid password:(NSString *)password
}
}

- (void)onAddNetworkResponse:(NSError *)error
{
if (error != nil) {
NSLog(@"Error adding network: %@", error);
return;
}

__auto_type * params = [[CHIPNetworkCommissioningClusterConnectNetworkParams alloc] init];

NSString * ssid = CHIPGetDomainValueForKey(kCHIPToolDefaultsDomain, kNetworkSSIDDefaultsKey);
params.networkID = [ssid dataUsingEncoding:NSUTF8StringEncoding];
params.breadcrumb = @(0);

__weak typeof(self) weakSelf = self;
[_cluster connectNetworkWithParams:params
completionHandler:^(CHIPNetworkCommissioningClusterConnectNetworkResponseParams * _Nullable response,
NSError * _Nullable err) {
// TODO: connectNetworkWithParams returns status in its
// response, not via the NSError!
[weakSelf onConnectNetworkResponse:err];
}];
}

- (void)onConnectNetworkResponse:(NSError *)error
{
if (error != nil) {
NSLog(@"Error enabling network: %@", error);
}

uint64_t deviceId = CHIPGetNextAvailableDeviceID() - 1;
CHIPDeviceController * controller = InitializeCHIP();
[controller updateDevice:deviceId fabricId:0];
}

- (void)onCommissioningComplete:(NSError * _Nullable)error
{
if (error != nil) {
Expand Down
1 change: 0 additions & 1 deletion src/darwin/Framework/CHIP/CHIPDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ typedef void (^CHIPDeviceConnectionCallback)(CHIPDevice * _Nullable device, NSEr
error:(NSError * __autoreleasing *)error;

- (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *)error;
- (void)updateDevice:(uint64_t)deviceID fabricId:(uint64_t)fabricId;

- (nullable CHIPDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error;
- (BOOL)getConnectedDevice:(uint64_t)deviceID
Expand Down
15 changes: 0 additions & 15 deletions src/darwin/Framework/CHIP/CHIPDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -611,21 +611,6 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID
return [NSString stringWithCString:outCode.c_str() encoding:[NSString defaultCStringEncoding]];
}

- (void)updateDevice:(uint64_t)deviceID fabricId:(uint64_t)fabricId
{
__block CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE;
if (![self isRunning]) {
[self checkForError:errorCode logMsg:kErrorNotRunning error:nil];
return;
}
dispatch_sync(_chipWorkQueue, ^{
if ([self isRunning]) {
errorCode = self.cppCommissioner->UpdateDevice(deviceID);
CHIP_LOG_ERROR("Update device address returned: %s", chip::ErrorStr(errorCode));
}
});
}

- (void)setPairingDelegate:(id<CHIPDevicePairingDelegate>)delegate queue:(dispatch_queue_t)queue
{
dispatch_async(_chipWorkQueue, ^{
Expand Down
5 changes: 0 additions & 5 deletions src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *)
return NO;
}

- (void)updateDevice:(uint64_t)deviceID fabricId:(uint64_t)fabricId
{
CHIP_LOG_ERROR("CHIPDevice doesn't support updateDevice:fabricId: over XPC");
}

- (nullable CHIPDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error
{
CHIP_LOG_ERROR("CHIPDevice doesn't support getDeviceBeingCommissioned over XPC");
Expand Down

0 comments on commit 3450163

Please sign in to comment.