Skip to content

Commit

Permalink
track heading
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonahoe committed Apr 14, 2011
1 parent 31d365b commit 03d59e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
19 changes: 12 additions & 7 deletions sensortest/iPhone/AppDelegate_iPhone.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
lman.desiredAccuracy = kCLLocationAccuracyBest;
lman.distanceFilter = 1.0;
[lman startUpdatingLocation];

[lman startUpdatingHeading];
//acceleration
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:1.0 / 30];
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
Expand All @@ -39,13 +39,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stdout);

//link to /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/PrivateFrameworks/VoiceServices.framework
voicebot = [[NSClassFromString(@"VSSpeechSynthesizer") alloc] init];
[voicebot setDelegate:self];
//voicebot = [[NSClassFromString(@"VSSpeechSynthesizer") alloc] init];
//[voicebot setDelegate:self];

startDate = [NSDate date];
[startDate retain];
mode=0;
[self nextMode];
//mode=0;
//[self nextMode];

return YES;
}
Expand Down Expand Up @@ -114,7 +114,12 @@ - (void) locationManager:(CLLocationManager *)manager
fromLocation:(CLLocation *)oldLocation
{
//NSLog(@"L:%@",newLocation);
printf("L:%f,%f,%f,%f\n",newLocation.coordinate.latitude,newLocation.coordinate.longitude,newLocation.horizontalAccuracy,[newLocation.timestamp timeIntervalSinceDate:startDate],[[NSDate date] timeIntervalSinceDate:startDate]);
printf("L:%f,%f,%f,%f,%f\n",newLocation.coordinate.latitude,newLocation.coordinate.longitude,newLocation.horizontalAccuracy,[newLocation.timestamp timeIntervalSinceDate:startDate],[[NSDate date] timeIntervalSinceDate:startDate]);
}

- (void) locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
//NSLog(@"heading: %@",newHeading);
printf("M:%f,%f,%f,%f,%f\n",newHeading.trueHeading,newHeading.x,newHeading.y,newHeading.z,[[NSDate date] timeIntervalSinceDate:startDate]);
}

- (void)dealloc {
Expand All @@ -124,7 +129,7 @@ - (void)dealloc {


- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
printf("A:%f,%f,%f,%f\n",acceleration.x,acceleration.y,acceleration.z,[[NSDate date] timeIntervalSinceDate:startDate]);
//printf("A:%f,%f,%f,%f\n",acceleration.x,acceleration.y,acceleration.z,[[NSDate date] timeIntervalSinceDate:startDate]);
}

@end
4 changes: 4 additions & 0 deletions sensortest/sensortest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = sensortest_Prefix.pch;
INFOPLIST_FILE = "sensortest-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = sensortest;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
Expand All @@ -223,7 +225,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = sensortest_Prefix.pch;
INFOPLIST_FILE = "sensortest-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = sensortest;
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down

0 comments on commit 03d59e4

Please sign in to comment.