SensorSamplingPackage
The built-in sampling package for collecting data from the phone's sensors.
Registered automatically in the SamplingPackageRegistry. Add a Measure with one of the measure types below to a task in your protocol to use it. All measures use the Smartphone primary device. It collects:
- accelerometer (rate of change in velocity, including and excluding gravity)
- gyroscope (rotation)
- magnetometer (compass)
- acceleration features (e.g. mean, variance, etc. calculated over a sampling period)
- ambient light (from the phone's light sensor)
- pedometer (step events)
Ambient light is only available on Android. Step events need the activity recognition permission.
Raw sensor measures emit many events per second. Use ACCELERATION_FEATURES or a short trigger window to limit data volume.
- Inheritance
-
- Object
- SamplingPackage
- SmartphoneSamplingPackage
- SensorSamplingPackage
Constructors
SensorSamplingPackage
Constants
ACCELERATION
Rate of change in velocity, including gravity, along perpendicular x, y, and z axes in the device's coordinate system.
- Event-based measure.
- Uses the Smartphone device for data collection.
- Uses a IntervalSamplingConfiguration sampling configuration.
ACCELERATION_FEATURES
A set of acceleration (non-gravitational) features calculated over a specific sampling period.
- Event-based measure.
- Uses the Smartphone device for data collection.
- Uses a PeriodicSamplingConfiguration for configuration. Default is 3 seconds sampling every minute.
AMBIENT_LIGHT
Ambient light from the phone's light sensor.
- Event-based measure.
- Android only.
- Uses the Smartphone device for data collection.
- Uses a PeriodicSamplingConfiguration for configuration. Default is 10 seconds sampling every 5 minutes.
MAGNETIC_FIELD
Magnetic field around the phone in x,y,z (typically measured by a magnetometer).
- Event-based measure.
- Uses the Smartphone device for data collection.
- Uses a IntervalSamplingConfiguration sampling configuration.
NON_GRAVITATIONAL_ACCELERATION
Rate of change in velocity, excluding gravity, along perpendicular x, y, and z axes in the phone's coordinate system.
- Event-based measure.
- Uses the Smartphone device for data collection.
- Uses a IntervalSamplingConfiguration sampling configuration.
ROTATION
Rotation of the phone in x,y,z (typically measured by a gyroscope).
- Event-based measure.
- Uses the Smartphone device for data collection.
- Uses a IntervalSamplingConfiguration sampling configuration.
STEP_COUNT
Total step count since last system boot from the phone's pedometer. Kept for backwards compatibility with CAMS 1.x protocols (protocol API level < 2.0) - use STEP_EVENT instead.
- Event-based measure.
- Uses the Smartphone device for data collection.
- No sampling configuration needed.
STEP_EVENT
Step event from the phone's pedometer. Note that this measure type is different from the "stepcount" measure type, which provides aggregated step counts over a time period.
- Event-based measure (one event per step).
- Uses the Smartphone device for data collection.
- No sampling configuration needed.
Properties
samplingSchemes
The default sampling schemes for all dataTypes in this package.
All sampling packages should define 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.