Skip to content

Commit

Permalink
Add enumeration to CHIPTool and fix CHIPTool builds (#14901)
Browse files Browse the repository at this point in the history
* Add enumeration to CHIPTool and fix CHIPTool builds

* Restyled by clang-format

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Feb 23, 2022
1 parent a157b8a commit 2545004
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 166 deletions.
18 changes: 9 additions & 9 deletions src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
2C21071525D1A8F200DDA4AD /* MultiAdminViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C21071325D1A8F200DDA4AD /* MultiAdminViewController.m */; };
2C460C2425D7594B000512D6 /* DeviceSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C460C2325D7594B000512D6 /* DeviceSelector.m */; };
2C460C3225D97CB3000512D6 /* UnpairDevicesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C460C3025D97CB3000512D6 /* UnpairDevicesViewController.m */; };
991DC091247747F500C13860 /* EchoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 991DC090247747F500C13860 /* EchoViewController.m */; };
991DC091247747F500C13860 /* EnumerateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 991DC090247747F500C13860 /* EnumerateViewController.m */; };
997A639C253F93F7005C64E6 /* CHIP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 997A639B253F93F7005C64E6 /* CHIP.framework */; };
997A639D253F93F7005C64E6 /* CHIP.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 997A639B253F93F7005C64E6 /* CHIP.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B204A621244E1D0600C7C0E1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B204A620244E1D0600C7C0E1 /* AppDelegate.m */; };
Expand Down Expand Up @@ -62,8 +62,8 @@
2C460C2325D7594B000512D6 /* DeviceSelector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeviceSelector.m; sourceTree = "<group>"; };
2C460C3025D97CB3000512D6 /* UnpairDevicesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UnpairDevicesViewController.m; sourceTree = "<group>"; };
2C460C3125D97CB3000512D6 /* UnpairDevicesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnpairDevicesViewController.h; sourceTree = "<group>"; };
991DC08F247747F500C13860 /* EchoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EchoViewController.h; sourceTree = "<group>"; };
991DC090247747F500C13860 /* EchoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EchoViewController.m; sourceTree = "<group>"; };
991DC08F247747F500C13860 /* EnumerateViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EnumerateViewController.h; sourceTree = "<group>"; };
991DC090247747F500C13860 /* EnumerateViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EnumerateViewController.m; sourceTree = "<group>"; };
997A639B253F93F7005C64E6 /* CHIP.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CHIP.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B204A61C244E1D0600C7C0E1 /* CHIPTool.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CHIPTool.app; sourceTree = BUILT_PRODUCTS_DIR; };
B204A61F244E1D0600C7C0E1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -123,13 +123,13 @@
path = QRCode;
sourceTree = "<group>";
};
0C79937924858B4F0047A373 /* Echo client */ = {
0C79937924858B4F0047A373 /* Enumeration */ = {
isa = PBXGroup;
children = (
991DC08F247747F500C13860 /* EchoViewController.h */,
991DC090247747F500C13860 /* EchoViewController.m */,
991DC08F247747F500C13860 /* EnumerateViewController.h */,
991DC090247747F500C13860 /* EnumerateViewController.m */,
);
path = "Echo client";
path = Enumeration;
sourceTree = "<group>";
};
0CA0E0D0248599C4009087B9 /* OnOffCluster */ = {
Expand Down Expand Up @@ -236,7 +236,7 @@
B2946A3F24C99D21005C87D0 /* WiFi */,
0C79937824858B3B0047A373 /* QRCode */,
B2C22672262892D7009DAB8B /* Fabric */,
0C79937924858B4F0047A373 /* Echo client */,
0C79937924858B4F0047A373 /* Enumeration */,
0CA0E0D0248599C4009087B9 /* OnOffCluster */,
);
path = "View Controllers";
Expand Down Expand Up @@ -393,7 +393,7 @@
2C460C3225D97CB3000512D6 /* UnpairDevicesViewController.m in Sources */,
B232D8BA2514BD0800792CB4 /* CHIPUIViewUtils.m in Sources */,
B2946A9B24C9A7BF005C87D0 /* DefaultsUtils.m in Sources */,
991DC091247747F500C13860 /* EchoViewController.m in Sources */,
991DC091247747F500C13860 /* EnumerateViewController.m in Sources */,
B2C2267526289324009DAB8B /* FabricUIViewController.m in Sources */,
B2B0209225C9C1AC00A4C220 /* BindingsViewController.m in Sources */,
B204A621244E1D0600C7C0E1 /* AppDelegate.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,12 @@ - (IBAction)bind:(id)sender
uint64_t nodeId;
NSScanner * scanner = [NSScanner scannerWithString:_nodeIDTextField.text];
[scanner scanUnsignedLongLong:&nodeId];
int endpointId = [_endpointIDTextField.text intValue];
int groupId = [_groupIDTextField.text intValue];
int clusterId = [_clusterIDTextField.text intValue];

// TODO Binding Support was removed from ObjC Clusters.h
if (CHIPGetConnectedDevice(^(CHIPDevice * _Nullable chipDevice, NSError * _Nullable error) {
if (chipDevice) {
CHIPBinding * cluster = [[CHIPBinding alloc] initWithDevice:chipDevice endpoint:0 queue:dispatch_get_main_queue()];
__auto_type * params = [[CHIPBindingClusterBindParams alloc] init];
params.nodeId = @(nodeId);
params.groupId = @(groupId);
params.endpointId = @(endpointId);
params.clusterId = @(clusterId);
[cluster bindWithParams:params
completionHandler:^(NSError * _Nullable error) {
NSString * resultString = (error == nil)
? @"Bind command: success!"
: [NSString stringWithFormat:@"An error occurred: 0x%02lx", error.code];
NSLog(resultString, nil);
}];
NSString * resultString = [NSString stringWithFormat:@"Not Supported"];
NSLog(resultString, nil);
} else {
NSLog(@"Status: Failed to establish a connection with the device");
}
Expand All @@ -163,26 +150,10 @@ - (IBAction)bind:(id)sender

- (IBAction)unbind:(id)sender
{
int nodeId = [_nodeIDTextField.text intValue];
int endpointId = [_endpointIDTextField.text intValue];
int groupId = [_groupIDTextField.text intValue];
int clusterId = [_clusterIDTextField.text intValue];

if (CHIPGetConnectedDevice(^(CHIPDevice * _Nullable chipDevice, NSError * _Nullable error) {
if (chipDevice) {
CHIPBinding * cluster = [[CHIPBinding alloc] initWithDevice:chipDevice endpoint:0 queue:dispatch_get_main_queue()];
__auto_type * params = [[CHIPBindingClusterUnbindParams alloc] init];
params.nodeId = @(nodeId);
params.groupId = @(groupId);
params.endpointId = @(endpointId);
params.clusterId = @(clusterId);
[cluster unbindWithParams:params
completionHandler:^(NSError * _Nullable error) {
NSString * resultString = (error == nil)
? @"Unbind command: success!"
: [NSString stringWithFormat:@"An error occurred: 0x%02lx", error.code];
NSLog(resultString, nil);
}];
NSString * resultString = [NSString stringWithFormat:@"Not Supported"];
NSLog(resultString, nil);
} else {
NSLog(@"Status: Failed to establish a connection with the device");
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

NS_ASSUME_NONNULL_BEGIN

@interface EchoViewController : UIViewController
@interface EnumerateViewController : UIViewController
@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 2545004

Please sign in to comment.