|
|
@ -80,19 +80,14 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
* Run the getFeature demo. Calls getFeature with a point known to have a feature and a point known |
|
|
|
* Run the getFeature demo. Calls getFeature with a point known to have a feature and a point known |
|
|
|
* not to have a feature. |
|
|
|
* not to have a feature. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@interface GetFeatureViewController : UIViewController |
|
|
|
@interface GetFeatureViewController : UIViewController { |
|
|
|
|
|
|
|
RTGRouteGuide *service; |
|
|
|
|
|
|
|
} |
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation GetFeatureViewController |
|
|
|
@implementation GetFeatureViewController |
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad { |
|
|
|
- (void)execRequest { |
|
|
|
[super viewDidLoad]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This only needs to be done once per host, before creating service objects for that host. |
|
|
|
|
|
|
|
[GRPCCall useInsecureConnectionsForHost:kHostAddress]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RTGRouteGuide *service = [[RTGRouteGuide alloc] initWithHost:kHostAddress]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void (^handler)(RTGFeature *response, NSError *error) = ^(RTGFeature *response, NSError *error) { |
|
|
|
void (^handler)(RTGFeature *response, NSError *error) = ^(RTGFeature *response, NSError *error) { |
|
|
|
if (response.name.length) { |
|
|
|
if (response.name.length) { |
|
|
|
NSLog(@"Found feature called %@ at %@.", response.name, response.location); |
|
|
|
NSLog(@"Found feature called %@ at %@.", response.name, response.location); |
|
|
@ -111,6 +106,19 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
[service getFeatureWithRequest:[RTGPoint message] handler:handler]; |
|
|
|
[service getFeatureWithRequest:[RTGPoint message] handler:handler]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad { |
|
|
|
|
|
|
|
[super viewDidLoad]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This only needs to be done once per host, before creating service objects for that host. |
|
|
|
|
|
|
|
[GRPCCall useInsecureConnectionsForHost:kHostAddress]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
service = [[RTGRouteGuide alloc] initWithHost:kHostAddress]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidAppear:(BOOL)animated { |
|
|
|
|
|
|
|
[self execRequest]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -120,16 +128,15 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
* Run the listFeatures demo. Calls listFeatures with a rectangle containing all of the features in |
|
|
|
* Run the listFeatures demo. Calls listFeatures with a rectangle containing all of the features in |
|
|
|
* the pre-generated database. Prints each response as it comes in. |
|
|
|
* the pre-generated database. Prints each response as it comes in. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@interface ListFeaturesViewController : UIViewController |
|
|
|
@interface ListFeaturesViewController : UIViewController { |
|
|
|
|
|
|
|
RTGRouteGuide *service; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation ListFeaturesViewController |
|
|
|
@implementation ListFeaturesViewController |
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad { |
|
|
|
- (void)execRequest { |
|
|
|
[super viewDidLoad]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RTGRouteGuide *service = [[RTGRouteGuide alloc] initWithHost:kHostAddress]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RTGRectangle *rectangle = [RTGRectangle message]; |
|
|
|
RTGRectangle *rectangle = [RTGRectangle message]; |
|
|
|
rectangle.lo.latitude = 405E6; |
|
|
|
rectangle.lo.latitude = 405E6; |
|
|
|
rectangle.lo.longitude = -750E6; |
|
|
|
rectangle.lo.longitude = -750E6; |
|
|
@ -147,6 +154,16 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad { |
|
|
|
|
|
|
|
[super viewDidLoad]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
service = [[RTGRouteGuide alloc] initWithHost:kHostAddress]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidAppear:(BOOL)animated { |
|
|
|
|
|
|
|
[self execRequest]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -157,14 +174,15 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
* database with a variable delay in between. Prints the statistics when they are sent from the |
|
|
|
* database with a variable delay in between. Prints the statistics when they are sent from the |
|
|
|
* server. |
|
|
|
* server. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@interface RecordRouteViewController : UIViewController |
|
|
|
@interface RecordRouteViewController : UIViewController { |
|
|
|
|
|
|
|
RTGRouteGuide *service; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation RecordRouteViewController |
|
|
|
@implementation RecordRouteViewController |
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad { |
|
|
|
- (void)execRequest { |
|
|
|
[super viewDidLoad]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSString *dataBasePath = [NSBundle.mainBundle pathForResource:@"route_guide_db" |
|
|
|
NSString *dataBasePath = [NSBundle.mainBundle pathForResource:@"route_guide_db" |
|
|
|
ofType:@"json"]; |
|
|
|
ofType:@"json"]; |
|
|
|
NSData *dataBaseContent = [NSData dataWithContentsOfFile:dataBasePath]; |
|
|
|
NSData *dataBaseContent = [NSData dataWithContentsOfFile:dataBasePath]; |
|
|
@ -178,8 +196,6 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
return location; |
|
|
|
return location; |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
RTGRouteGuide *service = [[RTGRouteGuide alloc] initWithHost:kHostAddress]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[service recordRouteWithRequestsWriter:locations |
|
|
|
[service recordRouteWithRequestsWriter:locations |
|
|
|
handler:^(RTGRouteSummary *response, NSError *error) { |
|
|
|
handler:^(RTGRouteSummary *response, NSError *error) { |
|
|
|
if (response) { |
|
|
|
if (response) { |
|
|
@ -193,6 +209,16 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad { |
|
|
|
|
|
|
|
[super viewDidLoad]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
service = [[RTGRouteGuide alloc] initWithHost:kHostAddress]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidAppear:(BOOL)animated { |
|
|
|
|
|
|
|
[self execRequest]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -202,14 +228,15 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
* Run the routeChat demo. Send some chat messages, and print any chat messages that are sent from |
|
|
|
* Run the routeChat demo. Send some chat messages, and print any chat messages that are sent from |
|
|
|
* the server. |
|
|
|
* the server. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@interface RouteChatViewController : UIViewController |
|
|
|
@interface RouteChatViewController : UIViewController { |
|
|
|
|
|
|
|
RTGRouteGuide *service; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation RouteChatViewController |
|
|
|
@implementation RouteChatViewController |
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad { |
|
|
|
- (void)execRequest { |
|
|
|
[super viewDidLoad]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSArray *notes = @[[RTGRouteNote noteWithMessage:@"First message" latitude:0 longitude:0], |
|
|
|
NSArray *notes = @[[RTGRouteNote noteWithMessage:@"First message" latitude:0 longitude:0], |
|
|
|
[RTGRouteNote noteWithMessage:@"Second message" latitude:0 longitude:1], |
|
|
|
[RTGRouteNote noteWithMessage:@"Second message" latitude:0 longitude:1], |
|
|
|
[RTGRouteNote noteWithMessage:@"Third message" latitude:1 longitude:0], |
|
|
|
[RTGRouteNote noteWithMessage:@"Third message" latitude:1 longitude:0], |
|
|
@ -219,8 +246,6 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
return note; |
|
|
|
return note; |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
RTGRouteGuide *service = [[RTGRouteGuide alloc] initWithHost:kHostAddress]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[service routeChatWithRequestsWriter:notesWriter |
|
|
|
[service routeChatWithRequestsWriter:notesWriter |
|
|
|
eventHandler:^(BOOL done, RTGRouteNote *note, NSError *error) { |
|
|
|
eventHandler:^(BOOL done, RTGRouteNote *note, NSError *error) { |
|
|
|
if (note) { |
|
|
|
if (note) { |
|
|
@ -234,4 +259,14 @@ static NSString * const kHostAddress = @"localhost:50051"; |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad { |
|
|
|
|
|
|
|
[super viewDidLoad]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
service = [[RTGRouteGuide alloc] initWithHost:kHostAddress]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidAppear:(BOOL)animated { |
|
|
|
|
|
|
|
[self execRequest]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|