DeviceConfiguration
Describes a device that takes part in a study, as part of a protocol.
A device can be any electronic device, such as a sensor, video camera, desktop computer, or smartphone, that collects data which is incorporated into the platform after being processed by a primary device (potentially itself). Optionally, a device can present output and receive user input.
Key points:
- roleName identifies the device within a protocol and must be unique.
- Devices are either primary devices (PrimaryDeviceConfiguration, e.g. a Smartphone) or connected devices (e.g., a BLEHeartRateDevice) added with StudyProtocol.addConnectedDevice.
- dataTypeSamplingSchemes lists the data types the device can collect.
- At deployment, each device gets a DeviceRegistration of type
TRegistrationthat identifies the physical device.
CARP Mobile Sensing and its sampling packages add more device types, each handled at runtime by a DeviceManager.
- Inheritance
-
- Object
- Serializable
- DeviceConfiguration
- Implementers
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
DeviceConfiguration.fromJson
DeviceConfiguration
Constants
DEVICE_NAMESPACE
The JSON namespace of the CARP Core device types.
Properties
dataTypeSamplingSchemes
Sampling schemes for all the sensors available on this device.
Implementations of DeviceConfiguration should return a map of all supported sampling schemes here. Null in this base class.
defaultSamplingConfiguration
Sampling configurations which override the default configurations for data types available on this device, mapped by data type.
fromJsonFunction
The function which can convert a JSON string to an object of this type.
isOptional
Determines whether device registration for this device is optional prior to starting a study, i.e., whether the study can run without this device or not.
jsonType
Return the __type to be used for JSON serialization of this class. Default is runtimeType. Only specify this if you need another type.
roleName
A name which describes how the device participates within the study protocol; its 'role'. For example, 'Parent's phone' or 'Child phone'. Must be unique within a protocol.
supportedDataTypes
The set of data types which can be collected on this device.
type
The device type identifier, i.e. its jsonType.
Methods
createRegistration
- @Deprecated('Use createRegistration on a DeviceManager instead, ' 'which allows for hardware-specific runtime registration options.')
Create a DeviceRegistration which can be used to configure this device for deployment.
Override this method to configure device-specific registration options, if any.
toJson
Return a JSON encoding of this object.
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.