Skip to content

Instantly share code, notes, and snippets.

@nfarah86
Created May 7, 2016 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfarah86/7eab61a1c385671b9cf63ef014ab3c3d to your computer and use it in GitHub Desktop.
Save nfarah86/7eab61a1c385671b9cf63ef014ab3c3d to your computer and use it in GitHub Desktop.
Pushing the Button Triggers Different End Points
// omitted code
-(void)bean:(PTDBean*)bean serialDataReceived:(NSData*)data
{
NSString *receivedMessage=[[NSString alloc]initWithData:data encoding:NSASCIIStringEncoding];
NSLog (@"%@ this works", receivedMessage);
NFHLocationManager *locationManager = [NFHLocationManager sharedLocationManager];
NFHWebServiceManager *webServiceManager = [NFHWebServiceManager sharedWebServiceManager];
if ([receivedMessage isEqualToString:@"L"]) {
[webServiceManager sendEmergencyRequest];
}
else if ([receivedMessage isEqualToString:@"S"]) {
if(locationManager.updating) {
[locationManager stopUpdates];
[webServiceManager endRunUpdateRequest];
}
else {
[webServiceManager startRunUpdateRequest];
[locationManager startStandardUpdates];
locationManager.updateHandler = ^(CLLocation *location){
[self updateInterfaceWithLocation:location];
};
}
}
else {
self.latitude.text=@"An error occurred";
}
}
// omitted code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment