ClientManager<TPrimaryDevice extends PrimaryDeviceConfiguration<TRegistration> , TRegistration extends DeviceRegistration, TStudy extends Study<PrimaryDeviceDeployment> > class
abstract
Manages the studies that run on a client device.
A client manager is the entry point of the client subsystem. It registers the device in study deployments, keeps track of the Studys on this device, and fetches their PrimaryDeviceDeployment from a DeploymentService.
Key points:
- Call configure once with a DeviceRegistration before any other call; most methods throw NotConfiguredException until then.
- Study lifecycle: addStudy -> tryDeployment (repeat until StudyStatus.Running) -> stopStudy or removeStudy.
- Deployment calls are delegated to a StudyDeploymentProxy; state is persisted in a ClientRepository.
- Subclasses overriding a lifecycle method must call
super.
See also SmartphoneClient. In CARP Mobile Sensing,
SmartPhoneClientManager extends this class and also runs the studies.
- Implementers
Constructors
-
ClientManager({ClientRepository<
TStudy> ? repository, DeploymentService? deploymentService, DeviceDataCollectorFactory? dataCollectorFactory}) - Create a new ClientManager.
Properties
- dataCollectorFactory → DeviceDataCollectorFactory?
-
Determines which DeviceDataCollector to use to collect data locally on
this primary device and this factory is used to create
ConnectedDeviceDataCollector instances for connected devices.
no setter
- deploymentService → DeploymentService
-
The application service through which study deployments, to be run on
this client, can be managed and retrieved.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConfigured → bool
-
Determines whether a DeviceRegistration has been configured for this client,
which is necessary to start adding studies.
no setter
- proxy ↔ StudyDeploymentProxy?
-
Performs deployment calls for studies; created by configure.
getter/setter pair
- registration → TRegistration
-
The registration of this client, set by configure.
no setter
-
repository
→ ClientRepository<
TStudy> -
Repository within which the state of this client is stored.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
studies
→ List<
TStudy> -
Get the studies running on this client device.
no setter
Methods
-
addStudy(
TStudy study) → Future< TStudy> -
Add a
studywhich needs to be executed on this client. No deployment is attempted yet. -
configure(
{required TRegistration registration, DeploymentService? deploymentService, DeviceDataCollectorFactory? dataCollectorFactory}) → Future< void> -
Configure this ClientManager by specifying a
registrationfor this client device. -
getStudy(
String studyDeploymentId, String deviceRoleName) → TStudy? -
Get the study with
studyDeploymentIdanddeviceRoleNamefrom this client manager. Returns null if no such study has been added. -
getStudyDeploymentStatus(
TStudy study) → Future< StudyDeploymentStatus?> -
Get the deployment status for the
studyfrom the deployment service. This updates the study's deployment status and sets the study's status accordingly. Returns null if the deployment status could not be retrieved from the deployment service or if the study has not been added to this client manager. -
getStudyStatusList(
) → List< StudyStatus> - Get the status for the studies which run on this client device. Note that this is the latest known status, held locally. If you want an updated status from the deployment service, use getStudyDeploymentStatus for each study.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeStudy(
String studyDeploymentId, String deviceRoleName) → Future< void> -
Remove the study with
studyDeploymentIdanddeviceRoleNamefrom this client manager. -
stopStudy(
String studyDeploymentId, String deviceRoleName) → Future< StudyStatus> -
Permanently stop collecting data for the study with id
studyDeploymentIdand mark it as stopped. -
toString(
) → String -
A string representation of this object.
inherited
-
tryDeployment(
String studyDeploymentId, String deviceRoleName) → Future< StudyStatus> -
Verifies whether the device is ready for deployment of the study runtime
identified by
studyDeploymentIdanddeviceRoleName, and in case it is, deploys. Also runs for a study that is already deployed, to refresh its deployment information. Returns the study's status afterwards.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited