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; 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.MqttClientService;
import efi.projekt.virtueller_gesundheitsassistent.service.StatisticsService;
import efi.projekt.virtueller_gesundheitsassistent.service.UnrealWebSocketService;
import java.io.IOException; import java.io.IOException;
import javafx.application.Application; import javafx.application.Application;
import static javafx.application.Application.launch; import static javafx.application.Application.launch;
@ -16,6 +21,15 @@ import javafx.stage.Stage;
*/ */
public class App extends Application { 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 @Override
public void start(Stage primaryStage) throws IOException { public void start(Stage primaryStage) throws IOException {
@ -23,11 +37,20 @@ public class App extends Application {
// Services initialisieren // Services initialisieren
// ========================= // =========================
// MQTT // Unreal-WebService
MqttClientService mqttClientService = new MqttClientService(); unrealService = new UnrealWebSocketService("127.0.0.1");
// Unreal WebSocket // MQTT-Service
// new UnrealWebSocketService("ws://localhost;8080/avatar"); mqttService = new MqttClientService();
// 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) { if (ratio >= 0.9) {
level = ProblemLevel.DISASTER; level = ProblemLevel.DISASTER;
} else if (ratio >= 0.7) { } else if (ratio >= 0.8) {
level = ProblemLevel.HIGH; level = ProblemLevel.HIGH;
} else if (ratio >= 0.4) { } else if (ratio >= 0.5) {
level = ProblemLevel.WARNING; level = ProblemLevel.WARNING;
} else { } else {
level = ProblemLevel.NONE; level = ProblemLevel.NONE;