Smartphone
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 roleName is 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
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
Smartphone.fromJson
Smartphone
- String roleName = Smartphone.DEFAULT_ROLE_NAME,
Creates a new Smartphone device.
If roleName is not specified, Smartphone.DEFAULT_ROLE_NAME is used.
Constants
DEFAULT_ROLE_NAME
The default role name for a smartphone.
DEVICE_TYPE
The type of a smartphone device.
Properties
dataTypeSamplingSchemes
Sampling schemes for all the sensors available on this device.
Implementations of DeviceConfiguration should simply return a map of all supported sampling schemes here.
fromJsonFunction
The function which can convert a JSON string to an object of this type.
jsonType
Return the __type to be used for JSON serialization of this class. Default is runtimeType. Only specify this if you need another type.
Methods
createRegistration
Creates a SmartphoneRegistration with details of this phone.
deviceId defaults to DeviceInfoService.deviceID and deviceDisplayName to a name built from platform, model, and SDK. Logs a warning if DeviceInfoService is not initialized.
toJson
Return a JSON encoding of this object.