deviceDeploymentReceived method
void
deviceDeploymentReceived([
- TDeviceDeployment? deployment
A new primary device deployment determining what data to collect for
this study has been received.
If deployment is not specified, the previously received deployment is
marked as updated.
Implementation
void deviceDeploymentReceived([TDeviceDeployment? deployment]) {
if (deploymentStatus == null) {
deploymentError(
"Can't receive device deployment before having received deployment status.",
);
return;
}
_deployment ??= deployment;
// if this is a new deployment, check that the role name matches
if (deployment != null) {
if (this.deployment?.deviceConfiguration.roleName != deviceRoleName) {
deploymentError(
"$runtimeType - The deployment is intended for a device with a different role name."
"Was expecting '$deviceRoleName' but got '${this.deployment?.deviceConfiguration.roleName}'.",
);
return;
}
}
// Listen to updates to the deployment and notify listeners.
deployment?.addListener(() => deploymentUpdated());
createEvent(
StudyStatusEvent(this, StudyStatusEventTypes.DeviceDeploymentReceived),
);
notifyListeners();
}