Skip to content

ESenseSamplingPackage

The sampling package for the eSense earable.

Collects button and motion sensor events from an eSense earable over Bluetooth Low Energy (BLE), using the esense_flutter plugin. Works on Android and iOS and needs the ESenseDevice connected device, which is handled by an ESenseDeviceManager.

Measure types:

  • dk.cachet.carp.esense.button (ESENSE_BUTTON): button pressed / released events.
  • dk.cachet.carp.esense.sensor (ESENSE_SENSOR): accelerometer and gyroscope events.

Key points:

Example of a protocol that collects eSense data as soon as the study starts:

  final eSense = ESenseDevice(samplingRate: 10);
  protocol.addConnectedDevice(eSense, phone);

  protocol.addTaskControl(
      ImmediateTrigger(),
      BackgroundTask(measures: [
        Measure(type: ESenseSamplingPackage.ESENSE_BUTTON),
        Measure(type: ESenseSamplingPackage.ESENSE_SENSOR),
      ]),
      eSense);

Register this package before running a study:

  SamplingPackageRegistry().register(ESenseSamplingPackage());
Implemented types

Constructors

ESenseSamplingPackage

ESenseSamplingPackage()

Constants

ESENSE_BUTTON

String const ESENSE_BUTTON

Measure type for continuous collection of eSense button events (pressed/released) as ESenseButton data.

ESENSE_NAMESPACE

String const ESENSE_NAMESPACE

The namespace of the eSense measure types, dk.cachet.carp.esense.

ESENSE_SENSOR

String const ESENSE_SENSOR

Measure type for continuous collection of eSense sensor events (accelerometer and gyroscope) as ESenseSensor data.

Properties

dataTypes

List<DataTypeMetaData> get dataTypes
override

The list of data type this package supports.

deviceManager

Get the DeviceManager for the device used by this package.

deviceType

String get deviceType
override

What device type is this package using?

This device type is matched with the DeviceConfiguration.roleName when a PrimaryDeviceConfiguration is deployed on the phone and executed by a SmartphoneStudyController.

Note that it is assumed that a sampling package only supports one type of device.

samplingSchemes

DataTypeSamplingSchemeMap get samplingSchemes
override

The default sampling schemes for all dataTypes in this package.

All sampling packages should defined a DataTypeSamplingScheme for each data type.

Methods

create

Probe? create(
  1. String type
)
override

Creates a new Probe of the specified type. Note that type should be one of the dataTypes that this package supports. Returns null if a probe cannot be created for the type.

onRegister

void onRegister()
override

Callback method when this package is being registered.