configure method

  1. @override
Future<void> configure({
  1. required DataEndPoint dataEndPoint,
  2. required SmartphoneDeployment deployment,
  3. required Stream<Measurement> measurements,
})
override

Configure the data manager by specifying the study deployment, the dataEndPoint, and the stream of measurements events to handle.

Implementation

@override
Future<void> configure({
  required DataEndPoint dataEndPoint,
  required SmartphoneDeployment deployment,
  required Stream<Measurement> measurements,
}) async {
  assert(dataEndPoint is FileDataEndPoint);
  await super.configure(
    dataEndPoint: dataEndPoint,
    deployment: deployment,
    measurements: measurements,
  );

  // _fileDataEndPoint = dataEndPoint as FileDataEndPoint;
  await Settings().getDeploymentBasePath(studyDeploymentId);

  if (fileDataEndPoint.encrypt) {
    assert(
      fileDataEndPoint.publicKey != null,
      'A public key is required if files are to be encrypted.',
    );
    assert(
      fileDataEndPoint.publicKey!.isNotEmpty,
      'A non-empty public key is required if files are to be encrypted.',
    );
  }

  // Initializing the the local directory and file
  await path;
  await file;
  await sink;

  info('Initializing FileDataManager...');
  info('Data file path : $_path');
  info('Buffer size    : ${fileDataEndPoint.bufferSize.toString()} bytes');
}