registerDevice method

Future<StudyDeploymentStatus> registerDevice({
  1. required String deviceRoleName,
  2. required DeviceRegistration registration,
})

Register a device for this deployment at the CARP server.

  • deviceRoleName - the role name of the device, e.g. phone.
  • registration - a unique id for the device.

Returns the updated study deployment status if the registration is successful. Throws a CarpServiceException if not.

Implementation

Future<StudyDeploymentStatus> registerDevice({
  required String deviceRoleName,
  required DeviceRegistration registration,
}) async {
  assert(deviceRoleName.isNotEmpty,
      'deviceRoleName has to be specified when registering a device in CARP.');

  return _status = StudyDeploymentStatus.fromJson(await _rpc(RegisterDevice(
    studyDeploymentId,
    deviceRoleName,
    registration,
  )));
}