Skip to content

Commit

Permalink
Merge pull request #316 from cph-cachet/308-weather-probe-not-working…
Browse files Browse the repository at this point in the history
…-when-air-quality-is-included

investigation of #308
  • Loading branch information
bardram authored Feb 13, 2023
2 parents eb7ab55 + 2fe871a commit cbd3d4e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CarpBackend {
CarpService().configure(app!);

// register CARP as a data backend where data can be uploaded
DataManagerRegistry().register(CarpDataManager());
DataManagerRegistry().register(CarpDataManagerFactory());

info('$runtimeType initialized');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SensingBLoC {
bool resumeSensingOnStartup = false,
}) async {
await Settings().init();
Settings().debugLevel = DebugLevel.DEBUG;
Settings().debugLevel = DebugLevel.debug;
this.deploymentMode = deploymentMode;
this.dataFormat = dataFormat;
_resumeSensingOnStartup = resumeSensingOnStartup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ part of mobile_sensing_app;
class StudyDeploymentModel {
SmartphoneDeployment deployment;

String get title => deployment.protocolDescription?.title ?? '';
String get title => deployment.studyDescription?.title ?? '';
String get description =>
deployment.protocolDescription?.description ??
'No description available.';
deployment.studyDescription?.description ?? 'No description available.';
Image get image => Image.asset('assets/study.png');
String get studyDeploymentId => deployment.studyDeploymentId;
String get userID => deployment.userId ?? '';
Expand All @@ -19,7 +18,7 @@ class StudyDeploymentModel {
/// Current state of the study executor (e.g., resumed, paused, ...)
ExecutorState get studyState => Sensing().controller!.executor!.state;

/// Get all sesing events (i.e. all [Datum] objects being collected).
/// Get all sensing events (i.e. all [Datum] objects being collected).
Stream<DataPoint> get data => Sensing().controller!.data;

/// The total sampling size so far since this study was started.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LocalStudyProtocolManager implements StudyProtocolManager {
name: protocolId,
);

protocol.protocolDescription = StudyDescription(
protocol.studyDescription = StudyDescription(
title: 'CAMS App - Sensing Coverage Study',
description:
'The default study testing coverage of most measures. Used in the coverage tests.',
Expand Down Expand Up @@ -126,22 +126,22 @@ class LocalStudyProtocolManager implements StudyProtocolManager {

// Add a background task that collects weather every 30 minutes.
protocol.addTriggeredTask(
IntervalTrigger(period: Duration(seconds: 30)),
IntervalTrigger(period: Duration(seconds: 20)),
BackgroundTask()
..addMeasure(Measure(type: ContextSamplingPackage.WEATHER)),
weatherService);

// // Define the online air quality service and add it as a 'device'
// AirQualityService airQualityService =
// AirQualityService(apiKey: '9e538456b2b85c92647d8b65090e29f957638c77');
// protocol.addConnectedDevice(airQualityService);
// Define the online air quality service and add it as a 'device'
AirQualityService airQualityService =
AirQualityService(apiKey: '9e538456b2b85c92647d8b65090e29f957638c77');
protocol.addConnectedDevice(airQualityService);

// // Add a background task that air quality every 30 minutes.
// protocol.addTriggeredTask(
// IntervalTrigger(period: Duration(minutes: 30)),
// BackgroundTask()
// ..addMeasure(Measure(type: ContextSamplingPackage.AIR_QUALITY)),
// airQualityService);
// Add a background task that air quality every 30 minutes.
protocol.addTriggeredTask(
IntervalTrigger(period: Duration(seconds: 30)),
BackgroundTask()
..addMeasure(Measure(type: ContextSamplingPackage.AIR_QUALITY)),
airQualityService);

// protocol.addTriggeredTask(
// ImmediateTrigger(),
Expand Down
2 changes: 1 addition & 1 deletion apps/carp_mobile_sensing_app/lib/src/sensing/sensing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Sensing {
// Register the CARP data manager for uploading data back to CARP.
// This is needed in both LOCAL and CARP deployments, since a local study
// protocol may still upload to CARP
DataManagerRegistry().register(CarpDataManager());
DataManagerRegistry().register(CarpDataManagerFactory());

// Create and configure a client manager for this phone
client = SmartPhoneClientManager();
Expand Down

0 comments on commit cbd3d4e

Please sign in to comment.