Skip to content
Merged
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
4 changes: 4 additions & 0 deletions carp_core/lib/client/study.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ enum StudyStatus {
/// Deployment can complete after all devices have been registered.
RegisteringDevices,

/// Device deployment for this primary device has completed,
/// but awaiting deployment of other devices in this study deployment.
AwaitingOtherDeviceDeployments,

/// Study runtime status when deployment has been successfully completed.
/// The [PrimaryDeviceDeployment] has been retrieved and all necessary plugins
/// to execute the study have been loaded.
Expand Down
26 changes: 15 additions & 11 deletions carp_mobile_sensing/lib/domain/study_protocol.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,24 @@ class SmartphoneStudyProtocol extends StudyProtocol
return true;
}

// Add the trigger, task completed, error, and heartbeat measures to the protocol
// since CAMS always collects and upload this data from any device.
/// Add the trigger, task completed, error, and heartbeat measures to the protocol
/// since CAMS always collects and upload this data from any device.
/// If the device is a primary device, also add the CompletedAppTask measure.
void _addSamplingTaskControl(DeviceConfiguration device) {
var measures = [
Measure(type: CarpDataTypes.ERROR_TYPE_NAME),
Measure(type: CarpDataTypes.TRIGGERED_TASK_TYPE_NAME),
Measure(type: CarpDataTypes.COMPLETED_TASK_TYPE_NAME),
Measure(type: Heartbeat.dataType),
];
if (device is PrimaryDeviceConfiguration) {
// For primary devices, also add the CompletedAppTask measure
measures.add(Measure(type: CompletedAppTask.dataType));
}

addTaskControl(
NoOpTrigger(),
BackgroundTask(measures: [
// CARP Core measures
Measure(type: CarpDataTypes.ERROR_TYPE_NAME),
Measure(type: CarpDataTypes.TRIGGERED_TASK_TYPE_NAME),
Measure(type: CarpDataTypes.COMPLETED_TASK_TYPE_NAME),
// CAMS specific measures
Measure(type: Heartbeat.dataType),
Measure(type: CompletedAppTask.dataType),
]),
BackgroundTask(measures: measures),
device,
Control.Start,
);
Expand Down
6 changes: 4 additions & 2 deletions packages/carp_movesense_package/lib/movesense_probes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ abstract class _MovesenseStreamProbe extends StreamProbe {

@override
Stream<Measurement>? get stream => deviceManager.isConnected
? _streamController.stream.map((event) =>
Measurement.fromData(_converter.call(jsonDecode(event)) as Data))
? _streamController.stream
.map((event) =>
Measurement.fromData(_converter.call(jsonDecode(event)) as Data))
.skip(10) // skip first 10 measurements to allow sensor to stabilize
: null;

@override
Expand Down