Smartphone class
The smartphone that runs a CAMS study: the primary device of a protocol.
Add it with SmartphoneStudyProtocol.addPrimaryDevice. It supports the measures of the built-in MonitoringSamplingPackage, DeviceSamplingPackage, and SensorSamplingPackage.
Key points:
- The default
roleNameis DEFAULT_ROLE_NAME. - createRegistration reads the phone details from DeviceInfoService; initialize it first to get correct values.
See also SmartphoneRegistration, the registration it creates.
- Inheritance
-
- Object
- Serializable
- DeviceConfiguration<
SmartphoneRegistration> - PrimaryDeviceConfiguration<
SmartphoneRegistration> - PrimaryDevice<
SmartphoneRegistration> - Smartphone
- Annotations
-
- @JsonSerializable.new(includeIfNull: false, explicitToJson: true)
Constructors
- Smartphone({String roleName = Smartphone.DEFAULT_ROLE_NAME})
- Creates a new Smartphone device.
-
Smartphone.fromJson(Map<
String, dynamic> json) -
factory
Properties
- $type ↔ String?
-
The type name written to
__typein JSON; set tojsonTypeon creation.getter/setter pairinherited - atStartOfStudy → TriggerConfiguration
-
A new trigger which fires immediately at the start of a study deployment
on this device.
no setterinherited
- dataTypeSamplingSchemes → DataTypeSamplingSchemeMap?
-
Sampling schemes for all the sensors available on this device.
no setteroverride
-
defaultSamplingConfiguration
↔ Map<
String, SamplingConfiguration> ? -
Sampling configurations which override the default configurations for
data types available on this device, mapped by data type.
getter/setter pairinherited
- 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 pairinherited
- isPrimaryDevice ↔ bool
-
Defaults to true. Only here for (de)serialization: for unknown device
types, the JSON tells whether to treat them as primary devices.
getter/setter pairinherited
- 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 pairinherited
- 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 setterinherited
- type → String
-
The device type identifier, i.e. its
jsonType.no setterinherited
Methods
-
acceptedRegistration(
DeviceRegistration registration) → DeviceRegistration -
The
registrationin the form the deployment service accepts for this device.inherited -
createRegistration(
{String? deviceId, String? deviceDisplayName}) → SmartphoneRegistration -
Creates a SmartphoneRegistration with details of this phone.
override
-
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.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- DEFAULT_ROLE_NAME → const String
- The default role name for a smartphone.
- DEVICE_TYPE → const String
- The type of a smartphone device.