SmartphoneDeployment.fromSmartphoneStudyProtocol constructor

SmartphoneDeployment.fromSmartphoneStudyProtocol({
  1. String? studyId,
  2. String? studyDeploymentId,
  3. String? userId,
  4. required String primaryDeviceRoleName,
  5. required SmartphoneStudyProtocol protocol,
})

Create a SmartphoneDeployment based on a SmartphoneStudyProtocol. This method basically makes a 1:1 mapping from the protocol to the deployment using a Smartphone as the primary device with the specified primaryDeviceRoleName.

Implementation

SmartphoneDeployment.fromSmartphoneStudyProtocol({
  this.studyId,
  String? studyDeploymentId,
  this.userId,
  required String primaryDeviceRoleName,
  required SmartphoneStudyProtocol protocol,
}) : super(
        deviceConfiguration: Smartphone(roleName: primaryDeviceRoleName),
        registration: DefaultDeviceRegistration(),
        connectedDevices: protocol.connectedDevices ?? {},
        connectedDeviceRegistrations: {},
        tasks: protocol.tasks,
        triggers: protocol.triggers,
        taskControls: protocol.taskControls,
        expectedParticipantData: protocol.expectedParticipantData ?? {},
      ) {
  _studyDeploymentId = studyDeploymentId ?? const Uuid().v1();
  _data.studyDescription = protocol.studyDescription;
  _data.dataEndPoint = protocol.dataEndPoint;
  _data.privacySchemaName = protocol.privacySchemaName;
  _data.applicationData = protocol._data.applicationData;
}