carp_core 0.20.1 copy "carp_core: ^0.20.1" to clipboard
carp_core: ^0.20.1 copied to clipboard

outdated

The core domain model for the CARP Mobile Sensing Framework in Flutter.

example/lib/example.dart

import 'package:carp_core/carp_core.dart';

// This example tries to mimic the example from the carp_core Kotlin
// example at https://github.com/cph-cachet/carp.core-kotlin/tree/master
void protocol() async {
  // Create a new study protocol.
  ProtocolOwner owner = ProtocolOwner();
  StudyProtocol protocol =
      StudyProtocol(owner: owner, name: "Track patient movement");

  // Define which devices are used for data collection.
  Smartphone phone = Smartphone(
    name: 'SM-A320FL',
    roleName: 'phone',
  );
  protocol.addMasterDevice(phone);

  // Define what needs to be measured, on which device, when.
  List<Measure> measures = [
    Measure(type: 'dk.cachet.geolocation'),
    Measure(type: 'dk.cachet.stepcount'),
  ];

  TaskDescriptor startMeasures = ConcurrentTask(
    name: "Start measures",
    measures: measures,
  );
  protocol.addTriggeredTask(Trigger(), startMeasures, phone);

  // JSON output of the study protocol, compatible with the rest of the CARP infrastructure.
  String json = toJsonString(protocol.toJson());
  print(json);
}
4
likes
0
pub points
74%
popularity

Publisher

verified publishercachet.dk

The core domain model for the CARP Mobile Sensing Framework in Flutter.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, json_annotation, meta, uuid

More

Packages that depend on carp_core