SamplingPackage
A plug-in that adds a set of measure types, and the probes that collect them, to CAMS.
Each sampling package covers one type of device (the phone, a wearable, a service) and is registered in the SamplingPackageRegistry at app start. When a study runs, CAMS asks the package that supports a Measure type to create a Probe for it.
A sampling package provides:
- dataTypes - the data types (measure types) it supports.
- samplingSchemes - the default SamplingConfiguration of each data type.
- deviceType and deviceManager - the device it collects data from.
- create - a factory for Probes.
// Register a sampling package before using its measures in a protocol.
SamplingPackageRegistry().register(ContextSamplingPackage());
See also SmartphoneSamplingPackage, the base for packages that collect data from the phone itself.
- Implementers
Constructors
SamplingPackage
Properties
dataTypes
The data types this package supports.
deviceManager
Get the DeviceManager for the device used by this package.
deviceType
The type of device this package collects data from.
On registration, deviceManager is registered in the DeviceController under this type, which is matched with the devices in a deployment.
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 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.
onRegister
Called when this package is registered in the SamplingPackageRegistry.
Use it to register JSON deserialization functions and data transformers.