-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompass.m
32 lines (26 loc) · 861 Bytes
/
compass.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import <CoreLocation/CoreLocation.h>
id api_getlocation()
{
CLLocationManager * locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
[locationManager setDesiredAccuracy:CLLocationAccuracyNearestTenMeters];
//[locationManager setDelegate:self];
CLLocation* location = [locationManager location];
return [location retain];
}
const char* api_location_to_text(id location)
{
NSString* newText = [NSString stringWithFormat: @"Your Position : %f %f", [location horizontalAccuracy], [location verticalAccuracy]];
return strdup([newText UTF8String]);
}
void api_free_location(id location)
{
[location release];
}
id get_degree()
{
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
return newHeading.magneticHeading*M_PI/180;
}
}