blob: 797ef0a63c004588f46b4c3415aed99eda8a2918 [file] [log] [blame]
Jorge Canizales34b26292015-06-02 02:11:09 -07001/*
2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34#import <UIKit/UIKit.h>
35#import <RouteGuide/RouteGuide.pbrpc.h>
36
37static NSString * const kHostAddress = @"http://localhost:50051";
38
39#pragma mark Get Feature
40
Jorge Canizales3aed7172015-06-04 22:56:21 -070041// Run the getFeature demo. Calls getFeature with a point known to have a feature and a point known
42// not to have a feature.
43
Jorge Canizales34b26292015-06-02 02:11:09 -070044@interface GetFeatureViewController : UIViewController
45@end
46
47@implementation GetFeatureViewController
48
49- (void)viewDidLoad {
50 [super viewDidLoad];
51
52 RTGRouteGuide *client = [[RTGRouteGuide alloc] initWithHost:kHostAddress];
53
Jorge Canizales3aed7172015-06-04 22:56:21 -070054 void (^handler)(RTGFeature *response, NSError *error) = ^(RTGFeature *response, NSError *error) {
55 if (response.name.length) {
56 NSLog(@"Found feature called %@ at %@.", response.name, response.location);
57 } else if (response) {
58 NSLog(@"Found no features at %@", response.location);
59 } else {
60 NSLog(@"RPC error: %@", error);
61 }
62 };
63
Jorge Canizales34b26292015-06-02 02:11:09 -070064 RTGPoint *point = [RTGPoint message];
65 point.latitude = 409146138;
66 point.longitude = -746188906;
67
Jorge Canizales3aed7172015-06-04 22:56:21 -070068 [client getFeatureWithRequest:point handler:handler];
69 [client getFeatureWithRequest:[RTGPoint message] handler:handler];
Jorge Canizales34b26292015-06-02 02:11:09 -070070}
71
72@end
73
74#pragma mark List Features
75
76@interface ListFeaturesViewController : UIViewController
77@end
78
79@implementation ListFeaturesViewController
80
81- (void)viewDidLoad {
82 [super viewDidLoad];
83 // Do any additional setup after loading the view, typically from a nib.
84}
85
86@end
87
88#pragma mark Record Route
89
90@interface RecordRouteViewController : UIViewController
91@end
92
93@implementation RecordRouteViewController
94
95- (void)viewDidLoad {
96 [super viewDidLoad];
97 // Do any additional setup after loading the view.
98}
99
100@end
101
102#pragma mark Route Chat
103
104@interface RouteChatViewController : UIViewController
105@end
106
107@implementation RouteChatViewController
108
109- (void)viewDidLoad {
110 [super viewDidLoad];
111 // Do any additional setup after loading the view.
112}
113
114@end