Created
May 7, 2016 03:46
-
-
Save nfarah86/7eab61a1c385671b9cf63ef014ab3c3d to your computer and use it in GitHub Desktop.
Pushing the Button Triggers Different End Points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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