Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BackgroundGeolocation/MAURConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ + (NSDictionary*) getDefaultTemplate
@"altitude": @"@altitude",
@"latitude": @"@latitude",
@"longitude": @"@longitude",
@"floor": @"@floor",
@"provider": @"provider",
@"locationProvider": @"@locationProvider",
@"radius": @"@radius",
Expand Down
1 change: 1 addition & 0 deletions BackgroundGeolocation/MAURLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ typedef NS_ENUM(NSInteger, MAURLocationStatus) {
@property (nonatomic, retain) NSNumber *heading;
@property (nonatomic, retain) NSNumber *altitude;
@property (nonatomic, retain) NSNumber *latitude;
@property (nonatomic, retain) NSNumber *floor;
@property (nonatomic, retain) NSNumber *longitude;
@property (nonatomic, retain) NSString *provider;
@property (nonatomic, retain) NSNumber *locationProvider;
Expand Down
11 changes: 9 additions & 2 deletions BackgroundGeolocation/MAURLocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ + (instancetype) map:(MAURLocation*)location

@implementation MAURLocation

@synthesize locationId, time, accuracy, altitudeAccuracy, speed, heading, altitude, latitude, longitude, provider, locationProvider, radius, isValid, recordedAt;
@synthesize locationId, time, accuracy, altitudeAccuracy, speed, heading, altitude, latitude, longitude, floor, provider, locationProvider, radius, isValid, recordedAt;

+ (instancetype) fromCLLocation:(CLLocation*)location;
{
Expand All @@ -84,6 +84,7 @@ + (instancetype) fromCLLocation:(CLLocation*)location;
instance.altitude = [NSNumber numberWithDouble:location.altitude];
instance.latitude = [NSNumber numberWithDouble:location.coordinate.latitude];
instance.longitude = [NSNumber numberWithDouble:location.coordinate.longitude];
instance.floor = [NSNumber numberWithDouble:location.floor.level];

return instance;
}
Expand All @@ -107,6 +108,7 @@ + (NSDictionary*) toDictionary:(CLLocation*)location;
[dict setObject:[NSNumber numberWithDouble:location.altitude] forKey:@"altitude"];
[dict setObject:[NSNumber numberWithDouble:location.coordinate.latitude] forKey:@"latitude"];
[dict setObject:[NSNumber numberWithDouble:location.coordinate.longitude] forKey:@"longitude"];
[dict setObject:[NSNumber numberWithDouble:location.floor.level] forKey:@"floor"];

return dict;
}
Expand Down Expand Up @@ -158,6 +160,7 @@ - (NSMutableDictionary*) toDictionary
if (altitude != nil) [dict setObject:altitude forKey:@"altitude"];
if (latitude != nil) [dict setObject:latitude forKey:@"latitude"];
if (longitude != nil) [dict setObject:longitude forKey:@"longitude"];
if (floor != nil) [dict setObject:floor forKey:@"floor"];
if (provider != nil) [dict setObject:provider forKey:@"provider"];
if (locationProvider != nil) [dict setObject:locationProvider forKey:@"locationProvider"];
if (radius != nil) [dict setObject:radius forKey:@"radius"];
Expand Down Expand Up @@ -202,6 +205,9 @@ - (id) getValueForKey:(id)key
if ([key isEqualToString:@"@longitude"]) {
return longitude;
}
if ([key isEqualToString:@"@floor"]) {
return floor;
}
if ([key isEqualToString:@"@provider"]) {
return provider;
}
Expand Down Expand Up @@ -322,7 +328,7 @@ - (BOOL) hasTime

- (NSString *) description
{
return [NSString stringWithFormat:@"Location: id=%@ time=%@ lat=%@ lon=%@ accu=%@ aaccu=%@ speed=%@ bear=%@ alt=%@", locationId, time, latitude, longitude, accuracy, altitudeAccuracy, speed, heading, altitude];
return [NSString stringWithFormat:@"Location: id=%@ time=%@ lat=%@ lon=%@ floor=%@ accu=%@ aaccu=%@ speed=%@ bear=%@ alt=%@", locationId, time, latitude, longitude, floor, accuracy, altitudeAccuracy, speed, heading, altitude];
}

-(id) copyWithZone: (NSZone *) zone
Expand All @@ -337,6 +343,7 @@ -(id) copyWithZone: (NSZone *) zone
copy.altitude = altitude;
copy.latitude = latitude;
copy.longitude = longitude;
copy.floor = floor;
copy.provider = provider;
copy.locationProvider = locationProvider;
copy.radius = radius;
Expand Down
1 change: 1 addition & 0 deletions BackgroundGeolocation/MAURLocationContract.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define LC_COLUMN_NAME_ALTITUDE "altitude"
#define LC_COLUMN_NAME_LATITUDE "latitude"
#define LC_COLUMN_NAME_LONGITUDE "longitude"
#define LC_COLUMN_NAME_FLOOR "floor"
#define LC_COLUMN_NAME_PROVIDER "provider"
#define LC_COLUMN_NAME_LOCATION_PROVIDER "service_provider"
#define LC_COLUMN_NAME_STATUS "valid"
Expand Down
1 change: 1 addition & 0 deletions BackgroundGeolocation/MAURLocationContract.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ + (NSString*) createTableSQL
@{ @"name": @LC_COLUMN_NAME_ALTITUDE, @"type": [SQLColumnType sqlColumnWithType: kReal]},
@{ @"name": @LC_COLUMN_NAME_LATITUDE, @"type": [SQLColumnType sqlColumnWithType: kReal]},
@{ @"name": @LC_COLUMN_NAME_LONGITUDE, @"type": [SQLColumnType sqlColumnWithType: kReal]},
@{ @"name": @LC_COLUMN_NAME_FLOOR, @"type": [SQLColumnType sqlColumnWithType: kReal]},
@{ @"name": @LC_COLUMN_NAME_PROVIDER, @"type": [SQLColumnType sqlColumnWithType: kText]},
@{ @"name": @LC_COLUMN_NAME_LOCATION_PROVIDER, @"type": [SQLColumnType sqlColumnWithType: kText]},
@{ @"name": @LC_COLUMN_NAME_STATUS, @"type": [SQLColumnType sqlColumnWithType: kInteger]},
Expand Down
26 changes: 18 additions & 8 deletions BackgroundGeolocation/MAURSQLiteLocationDAO.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ - (id) init {
@COMMA_SEP @LC_COLUMN_NAME_ALTITUDE
@COMMA_SEP @LC_COLUMN_NAME_LATITUDE
@COMMA_SEP @LC_COLUMN_NAME_LONGITUDE
@COMMA_SEP @LC_COLUMN_NAME_FLOOR
@COMMA_SEP @LC_COLUMN_NAME_PROVIDER
@COMMA_SEP @LC_COLUMN_NAME_LOCATION_PROVIDER
@COMMA_SEP @LC_COLUMN_NAME_RECORDED_AT
Expand All @@ -69,8 +70,9 @@ - (id) init {
location.altitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:5]];
location.latitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:6]];
location.longitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:7]];
location.provider = [rs stringForColumnIndex:8];
location.locationProvider = [NSNumber numberWithInt:[rs intForColumnIndex:9]];
location.floor = [NSNumber numberWithDouble:[rs doubleForColumnIndex:8]];
location.provider = [rs stringForColumnIndex:9];
location.locationProvider = [NSNumber numberWithInt:[rs intForColumnIndex:10]];
NSTimeInterval recordedAt = [rs longForColumnIndex:11];
location.recordedAt = [NSDate dateWithTimeIntervalSince1970:recordedAt];

Expand Down Expand Up @@ -98,6 +100,7 @@ - (id) init {
@COMMA_SEP @LC_COLUMN_NAME_ALTITUDE
@COMMA_SEP @LC_COLUMN_NAME_LATITUDE
@COMMA_SEP @LC_COLUMN_NAME_LONGITUDE
@COMMA_SEP @LC_COLUMN_NAME_FLOOR
@COMMA_SEP @LC_COLUMN_NAME_PROVIDER
@COMMA_SEP @LC_COLUMN_NAME_LOCATION_PROVIDER
@COMMA_SEP @LC_COLUMN_NAME_STATUS
Expand All @@ -117,10 +120,11 @@ - (id) init {
location.altitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:5]];
location.latitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:6]];
location.longitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:7]];
location.provider = [rs stringForColumnIndex:8];
location.locationProvider = [NSNumber numberWithInt:[rs intForColumnIndex:9]];
location.isValid = [rs intForColumnIndex:10] == 1 ? YES : NO;
NSTimeInterval recordedAt = [rs longForColumnIndex:11];
location.floor = [NSNumber numberWithDouble:[rs doubleForColumnIndex:8]];
location.provider = [rs stringForColumnIndex:9];
location.locationProvider = [NSNumber numberWithInt:[rs intForColumnIndex:10]];
location.isValid = [rs intForColumnIndex:11] == 1 ? YES : NO;
NSTimeInterval recordedAt = [rs longForColumnIndex:12];
location.recordedAt = [NSDate dateWithTimeIntervalSince1970:recordedAt];

[locations addObject:location];
Expand Down Expand Up @@ -148,6 +152,7 @@ - (id) init {
@COMMA_SEP @LC_COLUMN_NAME_ALTITUDE
@COMMA_SEP @LC_COLUMN_NAME_LATITUDE
@COMMA_SEP @LC_COLUMN_NAME_LONGITUDE
@COMMA_SEP @LC_COLUMN_NAME_FLOOR
@COMMA_SEP @LC_COLUMN_NAME_PROVIDER
@COMMA_SEP @LC_COLUMN_NAME_LOCATION_PROVIDER
@" FROM " @LC_TABLE_NAME @" WHERE " @LC_COLUMN_NAME_STATUS @" = ? ORDER BY " @LC_COLUMN_NAME_RECORDED_AT;
Expand All @@ -164,8 +169,9 @@ - (id) init {
location.altitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:5]];
location.latitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:6]];
location.longitude = [NSNumber numberWithDouble:[rs doubleForColumnIndex:7]];
location.provider = [rs stringForColumnIndex:8];
location.locationProvider = [NSNumber numberWithInt:[rs intForColumnIndex:9]];
location.floor = [NSNumber numberWithDouble:[rs doubleForColumnIndex:8]];
location.provider = [rs stringForColumnIndex:9];
location.locationProvider = [NSNumber numberWithInt:[rs intForColumnIndex:10]];

[locations addObject:location];
}
Expand Down Expand Up @@ -212,6 +218,7 @@ - (NSNumber*) persistLocation:(MAURLocation*)location intoDatabase:(FMDatabase*)
@COMMA_SEP @LC_COLUMN_NAME_ALTITUDE
@COMMA_SEP @LC_COLUMN_NAME_LATITUDE
@COMMA_SEP @LC_COLUMN_NAME_LONGITUDE
@COMMA_SEP @LC_COLUMN_NAME_FLOOR
@COMMA_SEP @LC_COLUMN_NAME_PROVIDER
@COMMA_SEP @LC_COLUMN_NAME_LOCATION_PROVIDER
@COMMA_SEP @LC_COLUMN_NAME_STATUS
Expand All @@ -226,6 +233,7 @@ - (NSNumber*) persistLocation:(MAURLocation*)location intoDatabase:(FMDatabase*)
location.altitude,
location.latitude,
location.longitude,
location.floor,
location.provider ?: [NSNull null],
location.locationProvider ?: [NSNull null],
location.isValid == YES ? @(1) : @(0),
Expand Down Expand Up @@ -296,6 +304,7 @@ - (NSNumber*) persistLocation:(MAURLocation*)location limitRows:(NSInteger)maxRo
@COMMA_SEP @LC_COLUMN_NAME_ALTITUDE @EQ_BIND
@COMMA_SEP @LC_COLUMN_NAME_LATITUDE @EQ_BIND
@COMMA_SEP @LC_COLUMN_NAME_LONGITUDE @EQ_BIND
@COMMA_SEP @LC_COLUMN_NAME_FLOOR @EQ_BIND
@COMMA_SEP @LC_COLUMN_NAME_PROVIDER @EQ_BIND
@COMMA_SEP @LC_COLUMN_NAME_LOCATION_PROVIDER @EQ_BIND
@COMMA_SEP @LC_COLUMN_NAME_STATUS @EQ_BIND
Expand All @@ -310,6 +319,7 @@ - (NSNumber*) persistLocation:(MAURLocation*)location limitRows:(NSInteger)maxRo
location.altitude,
location.latitude,
location.longitude,
location.floor,
location.provider ?: [NSNull null],
location.locationProvider ?: [NSNull null],
location.isValid == YES ? @(1) : @(0),
Expand Down