From 9955ed5cece15fa178c6f43b197ae27285878d45 Mon Sep 17 00:00:00 2001 From: Petter Rasmussen Date: Fri, 14 Jun 2024 12:07:32 +0200 Subject: [PATCH] Add offline and isarConnected prechecks --- backend/api/Services/RobotService.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backend/api/Services/RobotService.cs b/backend/api/Services/RobotService.cs index eb6ab7286..211704bf4 100644 --- a/backend/api/Services/RobotService.cs +++ b/backend/api/Services/RobotService.cs @@ -107,6 +107,20 @@ public async Task GetRobotWithPreCheck(string robotId) throw new RobotNotFoundException(errorMessage); } + if (robot.Status == RobotStatus.Offline) + { + string errorMessage = $"The robot with ID {robotId} is Offline"; + logger.LogError("{Message}", errorMessage); + throw new RobotPreCheckFailedException(errorMessage); + } + + if (robot.IsarConnected == false) + { + string errorMessage = $"The robot with ID {robotId} has connection issues. Isar not connected."; + logger.LogError("{Message}", errorMessage); + throw new RobotPreCheckFailedException(errorMessage); + } + if (robot.IsRobotPressureTooLow()) { string errorMessage = $"The robot pressure on {robot.Name} is too low to start a mission";