From 69c9cfd292c07725604f506a8952ade6d0b42cc8 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 8 Feb 2022 19:15:52 +0000 Subject: [PATCH] Restyled by clang-format --- .../Enumeration/EnumerateViewController.m | 60 ++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Enumeration/EnumerateViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/Enumeration/EnumerateViewController.m index d6536f3a5f3773..92cd4e822bafda 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Enumeration/EnumerateViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Enumeration/EnumerateViewController.m @@ -65,7 +65,7 @@ - (void)setupUIElements _sendButton = [UIButton new]; [_sendButton setTitle:@"Start" forState:UIControlStateNormal]; [_sendButton addTarget:self action:@selector(sendMessage:) forControlEvents:UIControlEventTouchUpInside]; - UIView * startView = [CHIPUIViewUtils stackViewWithButtons:@[_sendButton]]; + UIView * startView = [CHIPUIViewUtils stackViewWithButtons:@[ _sendButton ]]; [_stackView addArrangedSubview:startView]; startView.translatesAutoresizingMaskIntoConstraints = false; [startView.trailingAnchor constraintEqualToAnchor:_stackView.trailingAnchor].active = YES; @@ -99,7 +99,6 @@ - (IBAction)sendMessage:(id)sender [self enumerate]; } - // MARK: Enumeration Implementation // This API just walks over the accessory and tries to display its information. @@ -111,54 +110,59 @@ - (void)enumerate { CHIPGetConnectedDevice(^(CHIPDevice * _Nullable device, NSError * _Nullable error) { if (error) { - NSString *resultLog = [[NSString alloc] initWithFormat:@"Unable to get connected device: Error: %@", error]; + NSString * resultLog = [[NSString alloc] initWithFormat:@"Unable to get connected device: Error: %@", error]; [self updateResult:resultLog]; return; } - CHIPDescriptor *descriptorCluster = [[CHIPDescriptor alloc] initWithDevice:device endpoint:0 queue:dispatch_get_main_queue()]; + CHIPDescriptor * descriptorCluster = [[CHIPDescriptor alloc] initWithDevice:device + endpoint:0 + queue:dispatch_get_main_queue()]; NSLog(@"Reading parts list to get list of endpoints in use..."); - [descriptorCluster readAttributePartsListWithCompletionHandler:^(NSArray * _Nullable endpointsInUse, NSError * _Nullable error) { - if (error) - { - NSString *resultLog = [[NSString alloc] initWithFormat:@"Unable to read parts list: Error: %@", error]; + [descriptorCluster readAttributePartsListWithCompletionHandler:^( + NSArray * _Nullable endpointsInUse, NSError * _Nullable error) { + if (error) { + NSString * resultLog = [[NSString alloc] initWithFormat:@"Unable to read parts list: Error: %@", error]; [self updateResult:resultLog]; return; } - NSString *resultLog = [[NSString alloc] initWithFormat:@"Got list of endpoints in Use: %@", endpointsInUse]; + NSString * resultLog = [[NSString alloc] initWithFormat:@"Got list of endpoints in Use: %@", endpointsInUse]; [self updateResult:resultLog]; - for (NSNumber *endpoint in endpointsInUse) - { - CHIPDescriptor *descriptorCluster = [[CHIPDescriptor alloc] initWithDevice:device endpoint:[endpoint unsignedShortValue] queue:dispatch_get_main_queue()]; - [descriptorCluster readAttributeDeviceListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - if (error) - { - NSString *resultLog = [[NSString alloc] initWithFormat:@"Unable to read device list for Endpoint:%@ Error: %@", endpoint, error]; + for (NSNumber * endpoint in endpointsInUse) { + CHIPDescriptor * descriptorCluster = [[CHIPDescriptor alloc] initWithDevice:device + endpoint:[endpoint unsignedShortValue] + queue:dispatch_get_main_queue()]; + [descriptorCluster readAttributeDeviceListWithCompletionHandler:^( + NSArray * _Nullable value, NSError * _Nullable error) { + if (error) { + NSString * resultLog = [[NSString alloc] + initWithFormat:@"Unable to read device list for Endpoint:%@ Error: %@", endpoint, error]; [self updateResult:resultLog]; return; } - NSString *resultLog = [[NSString alloc] initWithFormat:@"Got device list for endpoint:%@ %@", endpoint, value]; + NSString * resultLog = [[NSString alloc] initWithFormat:@"Got device list for endpoint:%@ %@", endpoint, value]; [self updateResult:resultLog]; - [descriptorCluster readAttributeServerListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - if (error) - { - NSString *resultLog = [[NSString alloc] initWithFormat:@"Unable to read server list for Endpoint:%@ Error: %@", endpoint, error]; + [descriptorCluster + readAttributeServerListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + if (error) { + NSString * resultLog = [[NSString alloc] + initWithFormat:@"Unable to read server list for Endpoint:%@ Error: %@", endpoint, error]; + [self updateResult:resultLog]; + return; + } + + NSString * resultLog = + [[NSString alloc] initWithFormat:@"Got server list for endpoint:%@ %@", endpoint, value]; [self updateResult:resultLog]; - return; - } - - NSString *resultLog = [[NSString alloc] initWithFormat:@"Got server list for endpoint:%@ %@", endpoint, value]; - [self updateResult:resultLog]; - }]; + }]; }]; } }]; }); } - @end