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:
- Both measures are event-based and need no sampling configuration.
- Creates an ESenseButtonProbe or an ESenseSensorProbe for each measure.
- Registers ESenseDevice, ESenseButton and ESenseSensor for JSON deserialization, including the CAMS 1.x device type.
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
Constants
ESENSE_BUTTON
Measure type for continuous collection of eSense button events (pressed/released) as ESenseButton data.
ESENSE_NAMESPACE
The namespace of the eSense measure types, dk.cachet.carp.esense.
ESENSE_SENSOR
Measure type for continuous collection of eSense sensor events (accelerometer and gyroscope) as ESenseSensor data.
Properties
dataTypes
The list of data type this package supports.
deviceManager
Get the DeviceManager for the device used by this package.
deviceType
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
The default sampling schemes for all dataTypes in this package.
All sampling packages should defined a DataTypeSamplingScheme for each data type.
Methods
create
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
Callback method when this package is being registered.