Skip to content

Commit 7f4a91e

Browse files
committed
Support new functions to set a sensing interval and an accuracy parameter into the location sensor
1 parent 36be3df commit 7f4a91e

File tree

9 files changed

+37
-5
lines changed

9 files changed

+37
-5
lines changed

AWAREFramework.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'AWAREFramework'
11-
s.version = '1.14.16'
11+
s.version = '1.14.17'
1212
s.summary = 'AWARE: An Open-source Context Instrumentation Framework'
1313

1414
# This description is used to generate tags and improve search results.

AWAREFramework/Classes/Core/Storage/AWAREStorage.h

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ typedef void (^LimitedDataFetchHandler)(NSString * _Nonnull name, NSArray * _Nul
6161
- (void) unlock;
6262

6363
- (void) resetMark;
64+
- (void) resetCancelState;
6465

6566
- (BOOL) isStore;
6667
- (void) setStore:(BOOL) state;

AWAREFramework/Classes/Core/Storage/AWAREStorage.m

+4
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ - (void)resetMark{
303303

304304
}
305305

306+
- (void) resetCancelState {
307+
308+
}
309+
306310
- (bool)isSyncing {
307311
return NO;
308312
}

AWAREFramework/Classes/Core/Storage/SQLite/SQLiteSeparatedStorage.m

+3
Original file line numberDiff line numberDiff line change
@@ -676,5 +676,8 @@ - (NSUInteger)countStoredData:(NSString *)entityName
676676
return count;
677677
}
678678

679+
-(void)resetCancelState {
680+
isCanceled = NO;
681+
}
679682

680683
@end

AWAREFramework/Classes/Core/Storage/SQLite/SQLiteStorage.m

+4
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,10 @@ - (NSUInteger)countStoredDataFrom:(NSNumber * _Nullable)from context:(NSManagedO
770770
return [context countForFetchRequest:request error:&error];
771771
}
772772

773+
-(void)resetCancelState {
774+
isCanceled = NO;
775+
}
776+
773777
@end
774778

775779

AWAREFramework/Classes/Plugins/IOSActivityRecognition/IOSActivityRecognition.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ - (instancetype)initWithAwareStudy:(AWAREStudy *)study dbType:(AwareDBType)dbTyp
8686
_sensingInterval = 180; // 3min
8787
disposableCount = 0;
8888
preperiodDays = 0;
89-
_sensingMode = IOSActivityRecognitionModeLive;
89+
_sensingMode = IOSActivityRecognitionModeHistory;
9090
_confidenceFilter = CMMotionActivityConfidenceLow;
9191
}
9292
return self;
@@ -138,7 +138,7 @@ -(void)setParameters:(NSArray *)parameters{
138138
}
139139

140140
- (BOOL)startSensor{
141-
return [self startSensorWithConfidenceFilter:_confidenceFilter mode:IOSActivityRecognitionModeHistory interval:_sensingInterval disposableLimit:0];
141+
return [self startSensorWithConfidenceFilter:_confidenceFilter mode:_sensingMode interval:_sensingInterval disposableLimit:0];
142142
}
143143

144144
- (BOOL) startSensorAsLiveModeWithFilterLevel:(CMMotionActivityConfidence) filterLevel {

AWAREFramework/Classes/Sensors/Location/Locations.h

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ extern NSString * _Nonnull const AWARE_PREFERENCES_MIN_GPS_ACCURACY;
2828
- (BOOL) startSensorWithAccuracy:(double)accuracyMeter;
2929
- (BOOL) startSensorWithInterval:(double)interval accuracy:(double)accuracyMeter;
3030

31+
- (BOOL) setSensingInterval:(double)interval;
32+
- (BOOL) setSensingAccuracy:(double)accuracyMeter;
33+
- (BOOL) setSensingInterval:(double)interval accuracy:(double)accuracyMeter;
34+
3135
// - (void) saveLocation:(CLLocation *)location;
3236
// - (void) saveAuthorizationStatus:(CLAuthorizationStatus)status;
3337

AWAREFramework/Classes/Sensors/Location/Locations.m

+16
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,22 @@ - (void) saveAuthorizationStatus:(CLAuthorizationStatus ) status {
252252
@"event":@"saveAuthorizationStatus",@"status":@(status)}];
253253
}
254254

255+
- (BOOL)setSensingAccuracy:(double)accuracyMeter {
256+
self->accuracy = accuracyMeter;
257+
return YES;
258+
}
259+
260+
- (BOOL)setSensingInterval:(double)interval {
261+
self->interval = interval;
262+
return YES;
263+
}
264+
265+
- (BOOL)setSensingInterval:(double)interval accuracy:(double)accuracyMeter {
266+
self->interval = interval;
267+
self->accuracy = accuracyMeter;
268+
return YES;
269+
}
270+
255271

256272
#pragma mark - Location
257273

Example/AWARE-SensingApp/AppDelegate.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3333

3434
study.setCleanOldDataType(cleanOldDataTypeDaily)
3535
study.setDebug(true)
36-
study.setStudyURL("https://xxx")
36+
study.setStudyURL("https://")
3737

3838

3939
print(study.getCleanOldDataType())
@@ -71,7 +71,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7171
let headphone = HeadphoneMotion(awareStudy: study)
7272
headphone.setSensingIntervalWithHz(100)
7373
headphone.setSavingIntervalWithSecond(1)
74-
(headphone.storage as! SQLiteSeparatedStorage).fetchSizeAdjuster.setMaxFetchSize(2);
74+
// (headphone.storage as! SQLiteSeparatedStorage).fetchSizeAdjuster.setMaxFetchSize(30);
7575
headphone.storage?.setDebug(true)
7676
(headphone.storage as! SQLiteSeparatedStorage).useCompactDataSyncFormat = true
7777

0 commit comments

Comments
 (0)