EvaluationService with new thresholds and App with Service-init

This commit is contained in:
naumueller 2026-02-11 17:57:47 +01:00
parent b68cbe795c
commit e7b13fb896
2 changed files with 29 additions and 6 deletions

View File

@ -1,6 +1,11 @@
package efi.projekt.virtueller_gesundheitsassistent;
import efi.projekt.virtueller_gesundheitsassistent.model.AppState;
import efi.projekt.virtueller_gesundheitsassistent.service.DataPersistenceService;
import efi.projekt.virtueller_gesundheitsassistent.service.EvaluationService;
import efi.projekt.virtueller_gesundheitsassistent.service.MqttClientService;
import efi.projekt.virtueller_gesundheitsassistent.service.StatisticsService;
import efi.projekt.virtueller_gesundheitsassistent.service.UnrealWebSocketService;
import java.io.IOException;
import javafx.application.Application;
import static javafx.application.Application.launch;
@ -16,6 +21,15 @@ import javafx.stage.Stage;
*/
public class App extends Application {
private final AppState appState = new AppState();
// Services
private DataPersistenceService persistenceService;
private StatisticsService statisticsService;
private EvaluationService evaluationService;
private UnrealWebSocketService unrealService;
private MqttClientService mqttService;
@Override
public void start(Stage primaryStage) throws IOException {
@ -23,11 +37,20 @@ public class App extends Application {
// Services initialisieren
// =========================
// MQTT
MqttClientService mqttClientService = new MqttClientService();
// Unreal-WebService
unrealService = new UnrealWebSocketService("127.0.0.1");
// MQTT-Service
mqttService = new MqttClientService();
// Unreal WebSocket
// new UnrealWebSocketService("ws://localhost;8080/avatar");
// Datenbank initialisieren
persistenceService = new DataPersistenceService();
// Statistik-Service
statisticsService = new StatisticsService();
// Evaluationsservice
evaluationService = new EvaluationService(statisticsService, appState, unrealService);

View File

@ -35,9 +35,9 @@ public class EvaluationService {
if (ratio >= 0.9) {
level = ProblemLevel.DISASTER;
} else if (ratio >= 0.7) {
} else if (ratio >= 0.8) {
level = ProblemLevel.HIGH;
} else if (ratio >= 0.4) {
} else if (ratio >= 0.5) {
level = ProblemLevel.WARNING;
} else {
level = ProblemLevel.NONE;