unregisterDevice method

  1. @override
Future<StudyDeploymentStatus> unregisterDevice(
  1. String studyDeploymentId,
  2. String deviceRoleName
)
override

Unregister the device with the specified deviceRoleName for the study deployment with studyDeploymentId.

Implementation

@override
Future<StudyDeploymentStatus> unregisterDevice(
  String studyDeploymentId,
  String deviceRoleName,
) async {
  StudyDeployment deployment = _repository[studyDeploymentId]!;
  DeviceDescriptor device = deployment.registeredDevices.keys
      .firstWhere((descriptor) => descriptor.roleName == deviceRoleName);

  deployment.unregisterDevice(device);

  return deployment.status;
}