3 * Copyright (c) 2020 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #import "RootViewController.h"
19 #import "BindingsViewController.h"
20 #import "EchoViewController.h"
21 #import "MultiAdminViewController.h"
22 #import "OnOffViewController.h"
23 #import "QRCodeViewController.h"
24 #import "TemperatureSensorViewController.h"
25 #import "UnpairDevicesViewController.h"
26 #import "WifiViewController.h"
28 @implementation RootViewController
33 self.self.navigationItem.title = @"Connected Home over IP";
34 [self setUpTableView];
37 - (void)setUpTableView
39 self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
40 self.tableView.delegate = self;
41 self.tableView.dataSource = self;
42 [self.view addSubview:self.tableView];
44 @"QRCode scanner", @"Echo client", @"Light on / off cluster", @"Temperature Sensor", @"Bindings", @"Wifi Configuration",
45 @"Enable Pairing", @"Unpair Devices"
49 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
51 return _options.count;
54 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
56 static NSString * cellIdentifier = @"CHIPToolOptionCell";
58 UITableViewCell * cell = [self.tableView dequeueReusableCellWithIdentifier:cellIdentifier];
61 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
63 cell.textLabel.text = [_options objectAtIndex:indexPath.row];
67 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
69 [tableView deselectRowAtIndexPath:indexPath animated:YES];
70 switch (indexPath.row) {
72 [self pushQRCodeScanner];
75 [self pushEchoClient];
78 [self pushLightOnOffCluster];
81 [self pushTemperatureSensor];
87 [self pushNetworkConfiguration];
90 [self pushMultiAdmin];
93 [self pushUnpairDevices];
102 BindingsViewController * controller = [BindingsViewController new];
103 [self.navigationController pushViewController:controller animated:YES];
106 - (void)pushTemperatureSensor
108 TemperatureSensorViewController * controller = [TemperatureSensorViewController new];
109 [self.navigationController pushViewController:controller animated:YES];
112 - (void)pushNetworkConfiguration
114 WifiViewController * controller = [WifiViewController new];
115 [self.navigationController pushViewController:controller animated:YES];
118 - (void)pushQRCodeScanner
120 QRCodeViewController * controller = [QRCodeViewController new];
121 [self.navigationController pushViewController:controller animated:YES];
124 - (void)pushEchoClient
126 EchoViewController * controller = [EchoViewController new];
127 [self.navigationController pushViewController:controller animated:YES];
130 - (void)pushMultiAdmin
132 MultiAdminViewController * controller = [MultiAdminViewController new];
133 [self.navigationController pushViewController:controller animated:YES];
136 - (void)pushLightOnOffCluster
138 OnOffViewController * controller = [OnOffViewController new];
139 [self.navigationController pushViewController:controller animated:YES];
142 - (void)pushUnpairDevices
144 UnpairDevicesViewController * controller = [UnpairDevicesViewController new];
145 [self.navigationController pushViewController:controller animated:YES];