Skip to content

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:

See also SmartphoneRegistration, the registration it creates.

Inheritance
Annotations

Constructors

Smartphone.fromJson

Smartphone.fromJson(
  1. Map<String, dynamic> json
)

Smartphone

Smartphone({
  1. 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

String const DEFAULT_ROLE_NAME

The default role name for a smartphone.

DEVICE_TYPE

String const DEVICE_TYPE

The type of a smartphone device.

Properties

dataTypeSamplingSchemes

DataTypeSamplingSchemeMap? get dataTypeSamplingSchemes
override

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

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

jsonType

String get jsonType
override

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

SmartphoneRegistration createRegistration({
  1. String? deviceId,
  2. String? deviceDisplayName,
})
override

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

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.