Skip to content

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:

// 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

SamplingPackage()

Properties

dataTypes

List<DataTypeMetaData> get dataTypes

The data types this package supports.

deviceManager

Get the DeviceManager for the device used by this package.

deviceType

String get 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

DataTypeSamplingSchemeMap get samplingSchemes

The default sampling schemes for all dataTypes in this package.

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

Methods

create

Probe? create(
  1. String type
)

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()

Called when this package is registered in the SamplingPackageRegistry.

Use it to register JSON deserialization functions and data transformers.