Skip to content

SmartphoneStudy

A study that this phone takes part in, as seen by the SmartPhoneClientManager.

Identifies the study deployment and the device role this phone plays in it. The client manager creates one when you add a study (from a protocol or an invitation), then gets its SmartphoneDeployment and runs it.

Key points:

See also SmartphoneStudyController, which controls a running study.

Inheritance

Constructors

SmartphoneStudy.fromInvitation

SmartphoneStudy.fromInvitation(
  1. ActiveParticipationInvitation invitation
)

Creates a SmartphoneStudy from an invitation to a study.

The device role name defaults to Smartphone.DEFAULT_ROLE_NAME.

SmartphoneStudy.fromMap

SmartphoneStudy.fromMap(
  1. Map<String, Object?> map
)

Creates a SmartphoneStudy from a database row saved by the PersistenceService.

SmartphoneStudy

SmartphoneStudy({
  1. String? studyId,
  2. required String studyDeploymentId,
  3. required String deviceRoleName,
  4. String? participantId,
  5. String? participantRoleName,
  6. DateTime? createdOn,
  7. StudyDeploymentStatus? deploymentStatus,
  8. SmartphoneDeployment? deployment,
})

Creates a SmartphoneStudy.

Properties

events

Stream of study status events.

isDeployed

bool get isDeployed

Whether the deployment is available.

isSampling

bool get isSampling

Whether the study is sampling data, i.e. its samplingState is resumed.

participantId

String? participantId
getter/setter pair

The ID of the participant in this study.

participantRoleName

String? participantRoleName
getter/setter pair

The role of the participant in this study.

samplingState

The sampling state of this study, or null if not yet sampled.

Setting it adds a StudyStatusEventTypes.SamplingStateChanged event to events.

studyId

String? studyId
getter/setter pair

The unique id of the study in the deployment service.

null for a local study added from a protocol.

Methods

toString

String toString()
override

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.