carp_esense_package: ^0.12.2 copied to clipboard
The CARP eSense sampling package. Samples sensor and device events from the eSense ear plug device.
CARP eSense Sampling Package #
esense.button: eSense button pressed / released events
esense.sensor: eSense sensor (accelerometer & gyroscope) events.
See the user documentation on the eSense device for how to use the device.
esense_flutter Flutter plugin and its API documentation to understand how sensor data is generated and their data formats.
For Flutter plugins for other CARP products, see CARP Mobile Sensing in Flutter.
If you're interested in writing you own sampling packages for CARP, see the description on how to extend CARP on the wiki.
To use this package, add the following to you
pubspc.yaml file. Note that
this package only works together with
dependencies: flutter: sdk: flutter carp_mobile_sensing: ^0.11.0 carp_esense_package: ^0.11.0 ...
Android Integration #
Add the following to your app's
manifest.xml file located in
<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
NOTE: The first time the app starts, make sure to allow it to access the phone location. This is necessary to use the BLE on Android.
iOS Integration #
Requires iOS 10 or later. Hence, in your
Podfile in the
ios folder of your app,
make sure that the platform is set to
platform :ios, '10.0'
Add this permission in the
Info.plist file located in
<key>NSBluetoothAlwaysUsageDescription</key> <string>Uses bluetooth to connect to the eSense device</string> <key>UIBackgroundModes</key> <array> <string>audio</string> <string>external-accessory</string> <string>fetch</string> </array>
Using it #
To use this package, import it into your app together with the
import 'package:carp_mobile_sensing/carp_mobile_sensing.dart'; import 'package:carp_esense_package/esense.dart';
Before creating a study and running it, register this package in the SamplingPackageRegistry.
Once the package is registered,
ESenseMeasures can be added to a study like this.
// creating a eSense task collecting the inertial measurement unit (IMU) // sensor events and button press/release events from the eSense device. study ..addTriggerTask( ImmediateTrigger(), Task(name: 'eSense Sampling') ..addMeasure(ESenseMeasure( type: MeasureType( NameSpace.CARP, ESenseSamplingPackage.ESENSE_SENSOR, ), name: 'eSense - Sensors', enabled: true, deviceName: 'eSense-0332', samplingRate: 10, )) ..addMeasure(ESenseMeasure( type: MeasureType( NameSpace.CARP, ESenseSamplingPackage.ESENSE_BUTTON, ), name: 'eSense - Button', enabled: true, deviceName: 'eSense-0332', )));
Note that the eSense device must be paired with the phone via BTLE before CAMS can connect to it.