DeviceConfiguration<TRegistration extends DeviceRegistration> class
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.new(includeIfNull: false, explicitToJson: true)
Constructors
- DeviceConfiguration({required String roleName, bool? isOptional})
-
DeviceConfiguration.fromJson(Map<
String, dynamic> json) -
factory
Properties
- $type ↔ String?
-
The type name written to
__typein JSON; set tojsonTypeon creation.getter/setter pairinherited - dataTypeSamplingSchemes → DataTypeSamplingSchemeMap?
-
Sampling schemes for all the sensors available on this device.
no setter
-
defaultSamplingConfiguration
↔ Map<
String, SamplingConfiguration> ? -
Sampling configurations which override the default configurations for
data types available on this device, mapped by data type.
getter/setter pair
- fromJsonFunction → Function
-
The generated function that converts a JSON map to an object of this type.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isOptional ↔ bool?
-
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.
getter/setter pair
- jsonType → String
-
The
__typeused for JSON serialization of this class.no setteroverride - roleName ↔ String
-
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.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
supportedDataTypes
→ Set<
String> ? -
The set of data types which can be collected on this device.
no setter
- type → String
-
The device type identifier, i.e. its jsonType.
no setter
Methods
-
acceptedRegistration(
DeviceRegistration registration) → DeviceRegistration -
The
registrationin the form the deployment service accepts for this device. -
createRegistration(
{String? deviceId, String? deviceDisplayName}) → TRegistration - Create a DeviceRegistration which can be used to configure this device for deployment.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Returns a JSON map of this object, including the
__typeproperty.override -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- DEVICE_NAMESPACE → const String
- The JSON namespace of the CARP Core device types.