registerDevice method
Register the device with the specified deviceRoleName
for the study
deployment with studyDeploymentId
.
registration
is a matching configuration for the device with deviceRoleName
.
Implementation
@override
Future<StudyDeploymentStatus> registerDevice(
String studyDeploymentId,
String deviceRoleName,
DeviceRegistration registration,
) async {
StudyDeployment deployment = _repository[studyDeploymentId]!;
// check if already registered - if not register device
DeviceDescriptor device = deployment.registeredDevices.keys.firstWhere(
(descriptor) => descriptor.roleName == deviceRoleName,
orElse: () => DeviceDescriptor(roleName: deviceRoleName));
deployment.registerDevice(device, registration);
return deployment.status;
}