carp_core 0.20.3 copy "carp_core: ^0.20.3" to clipboard
carp_core: ^0.20.3 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
//
// It is a very simple example. Much better examples are found at the
// documentation of CARP Mobile Sensing at
//
//  * https://github.com/cph-cachet/carp.sensing-flutter
//  * https://github.com/cph-cachet/carp.sensing-flutter/wiki
void main(List<String> args) 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(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);
}
5
likes
0
pub points
75%
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