diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 9908cb0..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project exclude paths
-/CarControlUnit/target/
-/Common/target/
-/Server/target/
-/CarControlUnit/CarControlUnit.iml
-/Common/Common.iml
-/Server/Server.iml
-/bachelorthesis-java.iml
-/.idea/vcs.xml
-/.idea/.gitignore
-/.idea/.name
-/.idea/compiler.xml
-/.idea/misc.xml
-/.idea/modules.xml
-/.idea/uiDesigner.xml
-/.idea/*
-/.idea
-/OEMVerificationServer/target
diff --git a/CarControlUnit/pom.xml b/CarControlUnit/pom.xml
deleted file mode 100644
index 3d7e688..0000000
--- a/CarControlUnit/pom.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
- 4.0.0
-
-
- linushestermeyer
- bachelorthesis-java
- 1.0-SNAPSHOT
-
-
- linushestermeyer
- CarControlUnit
- 1.0-SNAPSHOT
-
-
-
- linushestermeyer
- Common
- 1.0-SNAPSHOT
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CarControlUnit/src/Car/MessageHandler.java b/CarControlUnit/src/Car/MessageHandler.java
deleted file mode 100644
index 81d8dd6..0000000
--- a/CarControlUnit/src/Car/MessageHandler.java
+++ /dev/null
@@ -1,344 +0,0 @@
-package Car;
-
-import Actions.GoAwayAction;
-import Actions.TargetAction;
-import EnvironmentObjects.IConnectionClient;
-import EnvironmentObjects.Provider;
-import EnvironmentObjects.Software.Software;
-import GUI.CCUMessageHandler.MessageHandlerPresenter;
-import GUI.Carla.CarlaPresenter;
-import Network.CarlaClientConnection;
-import Network.MMSClientConnection;
-import Network.NetworkConfig;
-import Network.OEMVerificationServerConnection.NettyClientInitializer;
-import Network.OEMVerificationServerConnection.NettyConnectionClient;
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
-import Messages.*;
-
-import java.util.ArrayList;
-
-public class MessageHandler {
-
-
- public static String MANIFEST =
- "Software:\r\n" +
- " DriveAutomaticBasic: 1.0\r\n" +
- " DriveInMcDonalds: 1.2\r\n";
-
- public static String MANIFEST_HACKED =
- "Software:\r\n" +
- " DriveAutomaticBasic: 1.0\r\n" +
- " DriveInMcDonalds: 1.2\r\n"+
- "hacked muhahahaha";
-
- public boolean hacked = false;
- public boolean suggestionReady = true;
- public boolean providerVerified = true;
-
- private IConnectionClient carlaConnection;
- private IConnectionClient mmsConnection;
-
- private final NettyClientInitializer nettyClientInitializer;
- private NettyConnectionClient swsConnection;
- private EventBus bus;
- private CarlaPresenter carlaPresenter;
- private MessageHandlerPresenter messageHandlerPresenter;
- private SoftwareManager mgr;
-
- private static MessageHandler handler;
-
- private MessageHandler() {
- this.bus=new EventBus();
- bus.register(this);
- this.carlaConnection = new CarlaClientConnection(bus);
- this.mmsConnection = new MMSClientConnection(bus);
- this.swsConnection= new NettyConnectionClient(bus);
- nettyClientInitializer = new NettyClientInitializer(swsConnection);
- this.swsConnection = (NettyConnectionClient)nettyClientInitializer.createNettyClientConnection(NetworkConfig.serverUrl,NetworkConfig.serverPort);
-
- this.carlaConnection.initBootstrap("127.0.0.1", 22898);
- this.mmsConnection.initBootstrap("127.0.0.1",22620);
- this.mgr =new SoftwareManager();
- }
-
- public static MessageHandler getInstance(){
- if(handler ==null){
- handler=new MessageHandler();
- }
- return handler;
- }
- public void sendToCarla(IMessage out){
- if(((CarlaClientConnection)this.carlaConnection).isRunning()) {
- this.carlaConnection.sendMessage(out);
- }
-
- }
- public void sendToMMS(IMessage out){
- if(((MMSClientConnection)this.mmsConnection).isRunning()){
- this.mmsConnection.sendMessage(out);
- } else {
- messageHandlerPresenter.printToLog("Tried to send "+out.toString()+ "but mms is not connected;");
- }
- }
- public void sendToSWS(IMessage out){
- this.swsConnection.sendMessage(out);
- }
- public void setMessageHandlerPresenter(MessageHandlerPresenter messageHandlerPresenter) {
- this.messageHandlerPresenter=messageHandlerPresenter;
- }
- public void setCarlaPresenter(CarlaPresenter carlaPresenter) {
- this.carlaPresenter=carlaPresenter;
- }
-
-
- private ArrayList registeringServices = new ArrayList<>();
-
- /**
- * Reads ServiceRegistrationMessages and passes them to the software being able to handle this Message.
- *
- * @param msg
- */
- @Subscribe
- public void registerService(ServiceRegistrationMessage msg){
- final String serviceSoftwareID= msg.getRequiredSWID();
- Software handlingSW = mgr.getSoftware(serviceSoftwareID);
- if(handlingSW != null && handlingSW.isUpTpDate()){
- boolean found = false;
- for(Provider provider : handlingSW.getVerifiedServiceProviders()){
- if(provider.getPublicProviderID() == msg.getProvider().getPublicProviderID())
- found= true;
- }
- if(!found && !providerVerified){//todo: verschönern, damit der boolean nicht weiter benötigt wird.
- messageHandlerPresenter.printToLog(
- "Service wird nicht vorgeschlagen, da der Service Provider nicht verifiziert ist:"+ msg.getDescription().getTitle());
-
- carlaPresenter.currentStage = CarlaPresenter.STAGE.CAR_DECLINED_SERVICE_OR_SOFTWARE;
- carlaPresenter.setUpButtons();
- return;
- }
- messageHandlerPresenter.printToLog(
- "Service wird zur Nutzung vorgeschlagen! "+ msg.getDescription().getTitle());
-
- mmsConnection.sendMessage(msg);
-
- carlaPresenter.currentStage = CarlaPresenter.STAGE.CAR_INSTALLING_SW;
- carlaPresenter.setUpButtons();
- } else{
- messageHandlerPresenter.printToLog(
- "Service möchte sich registrieren!"
- +"\n Für den Service wird eine neue Software benötigt! Speichere Anfrage... InquiryID: "+ msg.getInquiryID()
- +"\n Provider name: "+msg.getProvider().getProviderName()
- +"\n Service: "+msg.getDescription().getTitle()
- +"\n Beschreibung: "+msg.getDescription().getDescription()
- +"\n Software ID: "+msg.getRequiredSWID()
- );
-
- msg.setInstallSW(true);
- registeringServices.add(msg);
- SoftwareContentRequest cmd = new SoftwareContentRequest(msg.getDescription(), msg.getProvider(),msg.getInquiryID(), msg.getRequiredSWID());
- swsConnection.sendMessage(cmd);
- messageHandlerPresenter.printToLog("Software Beschreibung wird heruntergeladen.");
-
- carlaPresenter.currentStage = CarlaPresenter.STAGE.CAR_INSTALLING_SW;
- carlaPresenter.setUpButtons();
- }
- }
-
- @Subscribe
- public void waitForVerification(SoftwareContentMessage softwareContentMessage){
- messageHandlerPresenter.printToLog("Software Beschreibung vom Server erhalten:"
- +"\n Software ID: "+softwareContentMessage.getDesc().getTitle()
- +"\n Entwickler: "+softwareContentMessage.getProvider().getProviderName()
- );
- if(softwareContentMessage.isVerified()){
- for(ServiceRegistrationMessage msg : registeringServices){
- if(softwareContentMessage.getSoftwareID().equals(msg.getRequiredSWID())){
- SoftwareRegistrationMessage swRegistration = new SoftwareRegistrationMessage(
- softwareContentMessage.getDesc(),
- softwareContentMessage.getInquiryID(),
- softwareContentMessage.getSoftwareID(),
- softwareContentMessage.getProvider()
- );
- new Thread(){
- @Override
- public void run() {
- while(true) {
- System.err.println(suggestionReady);
- if(suggestionReady) {
- sendToMMS(swRegistration);
- break;
- }
- }
-
- }
- }.start();
- }
- }
- } else{
- System.err.println("Unverified SW got recommended!");
- }
- }
-
- @Subscribe
- public void handleActionCommand(ServiceActionCommand cmd){
- if(cmd.getAction() instanceof GoAwayAction){
- messageHandlerPresenter.printToLog("Fahranweisung vom Parkautomaten erhalten, ich entferne mich.");
- }else if (cmd.getAction() instanceof TargetAction){
- messageHandlerPresenter.printToLog("Parkticket gebucht und Parkplatz zugewiesen bekommen, ich parke!");
-
- }
- if(cmd.getAction() instanceof GoAwayAction)
- sendToCarla(new CarlaMessage(5));
- else
- sendToCarla(new CarlaMessage(4));
-
- final String serviceSWID =cmd.getRequiredSWID();
- Software handlingSW = mgr.getSoftware(serviceSWID);
- if(handlingSW != null)
- handlingSW.handleMessage(cmd);
-
- }
-
- @Subscribe
- public void waitForDecisions(ServiceDecisionMessage serviceDecisionMessage){
- final String serviceSoftwareID= serviceDecisionMessage.getRequiredSWID();
- Software handlingSW = mgr.getSoftware(serviceSoftwareID);
- if(handlingSW!=null) {
- //Todo: in handleMessage der Softwares muss die id des genutzten Angebots ausgewertet werden.
- //handleMessage wird nicht genutzt, da nicht notwendig für Prototypen
- //handlingSW.handleMessage(serviceDecisionMessage);
- }else{
- System.err.println("Die notwendige Software konnte nicht gestartet werden...");
- }
- if(serviceDecisionMessage.isAccepted()) {
- messageHandlerPresenter.printToLog(
- "Fahrer hat den Service angenommen. Leite die Entscheidung an den Parkautomaten weiter."
- );
- carlaPresenter.printToEnvironment(
- "Anfrage "+ serviceDecisionMessage.getInquiryID() +" wurde angenommen, bereit einen Parkplatz zuzuweisen.");
-
- carlaPresenter.currentStage = CarlaPresenter.STAGE.CAR_ACCEPTED_SERVICE;
- carlaPresenter.setUpButtons();
- }else{
- messageHandlerPresenter.printToLog(
- "Fahrer hat den Service nicht angenommen. Leite die Entscheidung an den Parkautomaten weiter."
- );
- carlaPresenter.printToEnvironment(
- "Anfrage "+ serviceDecisionMessage.getInquiryID() +" wurde abgelehnt, Fahrzeug kann verabschiedet werden.");
- carlaPresenter.currentStage = CarlaPresenter.STAGE.CAR_DECLINED_SERVICE_OR_SOFTWARE;
- carlaPresenter.setUpButtons();
- }
- }
-
-
- /**
- * Sends a SWInstallRequest to the OEMVerificationServer. Return expected form server: SoftwareInstallationMessage
- * @param softwareDecisionMessage
- */
- @Subscribe
- public void waitForSoftwareDecisions(SoftwareDecisionMessage softwareDecisionMessage){
- if(softwareDecisionMessage.isAccepted()){
- SoftwareInstallRequest req = new SoftwareInstallRequest(
- softwareDecisionMessage.getSoftwareID(),
- softwareDecisionMessage.getProvider(),
- getManifest());
- //todo: gewähltes Angebot berechnen
- messageHandlerPresenter.printToLog("Fahrer möchte neue Software installieren. Fordere diese vom Server an...");
- sendToSWS(req);
- } else{
- ServiceRegistrationMessage registrationMessage = null;
- for(ServiceRegistrationMessage msg : registeringServices){
- if(msg.getRequiredSWID().equals(softwareDecisionMessage.getSoftwareID())){
- registrationMessage= msg;
- }
- }
- registeringServices.remove(registrationMessage);
-
- messageHandlerPresenter.printToLog("Fahrer möchte keine Software installieren, ich entferne mich!");
- carlaPresenter.currentStage= CarlaPresenter.STAGE.CAR_DECLINED_SERVICE_OR_SOFTWARE;
- carlaPresenter.setUpButtons();
- }
- }
-
-
- @Subscribe
- public void waitForSoftwarePackage(SoftwareInstallationPackage installationPackage){
- if(installationPackage.getUpdatedManifest().equals(getManifest())){
- //Keine neue Software
- messageHandlerPresenter.printToLog("Error 502: Bad Request. Ihr Fahrzeug wurde nicht verifiziert. Sicherheitslücke!");
-
- ServiceRegistrationMessage registrationMessage = null;
- for(ServiceRegistrationMessage msg : registeringServices){
- if(installationPackage.getSoftwareID().equals(msg.getRequiredSWID())
- && msg.isInstallSW()){
- registrationMessage =msg;
- }
- }
- registeringServices.remove(registrationMessage);
- bus.post(new SoftwareDecisionMessage(registrationMessage.getInquiryID(),
- false,
- installationPackage.getSoftwareID(),
- installationPackage.getProvider()));
- } else{
- //Neue Software
- messageHandlerPresenter.printToLog("Neue Software installiert: "+installationPackage.getSoftware().getDescription().getTitle());
- Software toBeInstalled = installationPackage.getSoftware();
-
- //Kommunikationskanäle setzen
- toBeInstalled.setCarlaConnection(carlaConnection);
- toBeInstalled.setMmsConnection(mmsConnection);
- //toBeInstalled.setSwsConnection(swsConnection);
-
- //Software hinzufügen
- mgr.installSoftware(toBeInstalled);
- MANIFEST =installationPackage.getUpdatedManifest();
- carlaPresenter.setSwInstalled();
-
- System.err.println(getManifest());
- //Now that Software is installed, if a Sevrice is waiting for this to be installed the Process must continue
- ServiceRegistrationMessage registrationMessage = null;
- for(ServiceRegistrationMessage msg : registeringServices){
- if(installationPackage.getSoftwareID().equals(msg.getRequiredSWID())
- && msg.isInstallSW()){
- registrationMessage =msg;
- }
- }
- registeringServices.remove(registrationMessage);
- bus.post(registrationMessage);
- }
- }
-
- public String getManifest() {
- if(hacked)
- return MANIFEST_HACKED;
- else
- return MANIFEST;
- }
-
- public void post(IMessage msg){
- bus.post(msg);
- }
-
- public void hack() {
- if(hacked){
- hacked = false;
- } else{
- hacked=true;
- }
- }
- public void verifyProvider() {
- if(providerVerified){
- providerVerified = false;
- } else{
- providerVerified=true;
- }
- }
- public void showSWSuggestions() {
- if(suggestionReady){
- suggestionReady = false;
- } else{
- suggestionReady=true;
- }
- }
-}
diff --git a/CarControlUnit/src/Car/SoftwareManager.java b/CarControlUnit/src/Car/SoftwareManager.java
deleted file mode 100644
index 0299119..0000000
--- a/CarControlUnit/src/Car/SoftwareManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package Car;
-
-import EnvironmentObjects.Software.Software;
-import Messages.ServiceRegistrationMessage;
-
-import java.util.ArrayList;
-
-/**
- * Every Car has a SoftwareManager. the Softwaremanager forwards incoming messages to the specific Software which is needed to handle these Messages. It also prepares the installation of new Software.
- */
-public class SoftwareManager {
-
- private static ArrayList installedSW = new ArrayList<>();
-
- /**
- * Method to get a Software from the SoftwareManager by SoftwareID.
- *
- * @param serviceSoftwareID the id
- * @return the software requested by ID
- */
- public Software getSoftware(String serviceSoftwareID) {
- for(Software sw : installedSW){
- if(sw.getSoftwareID().equals(serviceSoftwareID)){
- return sw;
- }
- }
- return null;
- }
-
- /**
- * Called if a incoming Service requires a software which is not installed. This method passes Softwware-based
- * information to the MMS.
- *
- * @param msg
- */
- public void submitSoftware(ServiceRegistrationMessage msg) {
- msg.setInstallSW(true);
- MessageHandler.getInstance().sendToMMS(msg);
- }
-
-
- public void installSoftware(Software software) {
- installedSW.add(software);
- System.err.println("Installed new Software: " + software);
- }
-
- public void uninstallSoftware(Software software){
- installedSW.remove(software);
- }
-}
diff --git a/CarControlUnit/src/CarControlUnitMain.java b/CarControlUnit/src/CarControlUnitMain.java
deleted file mode 100644
index 2764c0c..0000000
--- a/CarControlUnit/src/CarControlUnitMain.java
+++ /dev/null
@@ -1,68 +0,0 @@
-import GUI.Main.MainPresenter;
-import GUI.Main.MainView;
-import Car.MessageHandler;
-import com.google.common.eventbus.EventBus;
-import com.airhacks.afterburner.injection.Injector;
-import javafx.application.Application;
-import javafx.application.Platform;
-import javafx.event.EventHandler;
-import javafx.scene.Scene;
-import javafx.stage.Stage;
-import javafx.stage.WindowEvent;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Linus Hestermeyer
- *
- * View.Main Class.
- */
-public class CarControlUnitMain extends Application {
-
- private MessageHandler handler;
-
- @Override
- public void start(Stage primaryStage) throws Exception {
- //Teile entnommen von: https://docs.oracle.com/javafx/2/get_started/hello_world.htm
- MainView mainView = new MainView();
-
- /**
- * Darstellen der Scene
- */
- Scene scene = new Scene(mainView.getView());
- primaryStage.setTitle("CarControlUnit GUI");
- primaryStage.setScene(scene);
-
- primaryStage.setOnCloseRequest(new EventHandler() {
- @Override
- public void handle(WindowEvent event) {
- Platform.exit();
- System.exit(0);
- }
- });
-
- /**
- * übergibt dem mainpresenter die primarystage, damit dieser die windowsize anpassen kann.
- */
- MainPresenter mainPresenter = (MainPresenter) mainView.getPresenter();
- mainPresenter.setStage(primaryStage);
-
- /**
- * sizetoScene muss hier geschehen, da im MainPresenter initalizer noch keine primarystage übergeben ist
- */
- primaryStage.sizeToScene();
- primaryStage.show();
-
- handler=MessageHandler.getInstance();
- handler.setCarlaPresenter(mainPresenter.getCarlaPresenter());
- handler.setMessageHandlerPresenter(mainPresenter.getMessageHandlerPresenter());
-
- mainPresenter.getCarlaPresenter().setCarLogRefference(mainPresenter.getMessageHandlerPresenter().logReceivedMessages);
- }
-
- @Override
- public void stop() throws Exception {
- Injector.forgetAll();
- }
-}
diff --git a/CarControlUnit/src/GUI/CCUMessageHandler/MessageHandlerPresenter.java b/CarControlUnit/src/GUI/CCUMessageHandler/MessageHandlerPresenter.java
deleted file mode 100644
index 0190f7d..0000000
--- a/CarControlUnit/src/GUI/CCUMessageHandler/MessageHandlerPresenter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package GUI.CCUMessageHandler;
-
-import GUI.LogPrinter;
-import javafx.fxml.FXML;
-import javafx.fxml.Initializable;
-import javafx.scene.control.ScrollPane;
-import javafx.scene.layout.BorderPane;
-
-import java.net.URL;
-import java.util.ResourceBundle;
-
-/**
- * Diese Klasse repräsentiert den MainPresenter der die Mainview steuert,
- * und somit die einzelnen Views lädt.
- *
- * @version 1.0
- */
-public class MessageHandlerPresenter implements Initializable {
-
- @FXML
- public BorderPane mainPane;
-
- @FXML
- public ScrollPane logReceivedMessages;
-
- @Override
- public void initialize(URL location, ResourceBundle resources) {
-
- }
-
- public void printToLog(String s) {
- LogPrinter.displayInView(logReceivedMessages, s);
- }
-
-}
\ No newline at end of file
diff --git a/CarControlUnit/src/GUI/CCUMessageHandler/MessageHandlerView.java b/CarControlUnit/src/GUI/CCUMessageHandler/MessageHandlerView.java
deleted file mode 100644
index 19fd346..0000000
--- a/CarControlUnit/src/GUI/CCUMessageHandler/MessageHandlerView.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package GUI.CCUMessageHandler;
-
-import com.airhacks.afterburner.views.FXMLView;
-//entnommen von http://afterburner.adam-bien.com/
-public class MessageHandlerView extends FXMLView {
-}
diff --git a/CarControlUnit/src/GUI/CCUMessageHandler/messagehandler.css b/CarControlUnit/src/GUI/CCUMessageHandler/messagehandler.css
deleted file mode 100644
index 5192fbc..0000000
--- a/CarControlUnit/src/GUI/CCUMessageHandler/messagehandler.css
+++ /dev/null
@@ -1,3 +0,0 @@
-#mainView{
-
-}
\ No newline at end of file
diff --git a/CarControlUnit/src/GUI/CCUMessageHandler/messagehandler.fxml b/CarControlUnit/src/GUI/CCUMessageHandler/messagehandler.fxml
deleted file mode 100644
index 2a5b595..0000000
--- a/CarControlUnit/src/GUI/CCUMessageHandler/messagehandler.fxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CarControlUnit/src/GUI/Carla/CarlaPresenter.java b/CarControlUnit/src/GUI/Carla/CarlaPresenter.java
deleted file mode 100644
index 3657d39..0000000
--- a/CarControlUnit/src/GUI/Carla/CarlaPresenter.java
+++ /dev/null
@@ -1,303 +0,0 @@
-package GUI.Carla;
-
-import Actions.GoAwayAction;
-import Actions.IAction;
-import Actions.TargetAction;
-import Car.MessageHandler;
-import EnvironmentObjects.Angebot;
-import EnvironmentObjects.Description;
-import EnvironmentObjects.Provider;
-import EnvironmentObjects.Software.ParkingServiceSoftware;
-import GUI.LogPrinter;
-import javafx.application.Platform;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.fxml.FXML;
-import javafx.fxml.Initializable;
-import javafx.scene.control.Button;
-import javafx.scene.control.Label;
-import javafx.scene.control.ScrollPane;
-import javafx.scene.paint.Color;
-import Messages.CarlaMessage;
-import Messages.ServiceActionCommand;
-import Messages.ServiceRegistrationMessage;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.ResourceBundle;
-
-/**
- * Diese Klasse repräsentiert den MainPresenter der die Mainview steuert,
- * und somit die einzelnen Views lädt.
- *
- * @version 1.0
- */
-public class CarlaPresenter implements Initializable {
-
-
- public static final String CAR_1_ID = "CAR-LA-1";
- public static final String CAR_1_MANIFEST =
- "software:\r\n" +
- " DriveAutomaticBasic: 1.0\r\n" +
- " DriveInMcDonalds: 1.2\r\n";
-
- //TODO: edit this according to your local Carla.exe/Carla.sh
- private static final String PATH =
- "D:\\Carla";
-
- @FXML
- public ScrollPane environmentlog;
-
- @FXML
- public Button startScenario; //start the engine
-
- @FXML
- public Button driveAround;
-
- @FXML
- public Button driveIntoPerceptionAreaButton;
-
- @FXML
- public Button sendServiceRegistrationMessage;
-
- @FXML
- public Button sendServiceActionButton;
-
- @FXML
- public Button sayGoodbye;
-
- @FXML
- public Button hack;
-
- @FXML
- public Label hackLabel;
-
- @FXML
- public Button svProviderVerified;
-
- @FXML
- public Label svProviderVerifiedLabel;
-
- @FXML
- public Button suggestionReady;
-
- @FXML
- public Label suggestionReadyLabel;
-
- @FXML
- public Label swInstalled;
-
- private boolean messageSent =false;
-
- private ScrollPane carLog;
-
- public void setCarLogRefference(ScrollPane carLog) {
- this.carLog=carLog;
- }
-
- public enum STAGE {
- NO_CAR_STARTED,
- NO_RUNNING_SCENARIO,
- NO_REGISTERED_CAR,
- CAR_IN_PERCEPTION_AREA,
- CAR_DECLINED_SERVICE_OR_SOFTWARE,
- CAR_INSTALLING_SW,
- CAR_ACCEPTED_SERVICE,
- CAR_PARKED
- }
- private Provider provider;
-
- public STAGE currentStage = STAGE.NO_CAR_STARTED;
-
-
- @Override
- public void initialize(URL location, ResourceBundle resources) {
- setUpButtons();
- startScenario.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- MessageHandler.getInstance().sendToCarla(new CarlaMessage(1));
- LogPrinter.displayInView(carLog, "Fahrzeug wurde in Carla gespawned.");
- currentStage=STAGE.NO_RUNNING_SCENARIO;
- setUpButtons();
- }
- });
- driveAround.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- MessageHandler.getInstance().sendToCarla(new CarlaMessage(2));
- LogPrinter.displayInView(carLog, "Fahrzeug fährt zum Parkplatz.");
- currentStage = STAGE.NO_REGISTERED_CAR;
- setUpButtons();
- }
- });
- driveIntoPerceptionAreaButton.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- MessageHandler.getInstance().sendToCarla(new CarlaMessage(3));
- currentStage = STAGE.CAR_IN_PERCEPTION_AREA;
- LogPrinter.displayInView(carLog, "Fahrzeug fährt in Registrierungszone des Parkplatzes.");
- LogPrinter.displayInView(environmentlog, "Fahrzeug in Registrierungszone erkannt. Registrierung möglich.");
- setUpButtons();
- }
- });
- sendServiceRegistrationMessage.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- ArrayList list = new ArrayList<>();
- list.add(new TargetAction());
- provider = new Provider(
- "ger_park_328_nds",
- "Parken in Oldenburg",
- "parken.stadt-oldenburg.de"
- );
- ArrayList angebotTitel = new ArrayList<>();
- angebotTitel.add("Preis pro Stunde");
-
- ArrayList angebote = new ArrayList<>();
- angebote.add(new Angebot(0.70));
- Description desc = new Description(
- "Parken in Oldenburg",
- "Parken Sie in nächster Nähe zur Oldenburger Innenstadt!",
- new ArrayList<>(),
- angebote,
- angebotTitel,
- list
- );
-
- ServiceRegistrationMessage msg = new ServiceRegistrationMessage(
- desc, 992120, provider, ParkingServiceSoftware.SOFTWARE_ID
- );
-
- MessageHandler.getInstance().post(msg);
-
- }
- });
- sendServiceActionButton.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- if(currentStage== STAGE.CAR_ACCEPTED_SERVICE) {
- ServiceActionCommand cmd = new ServiceActionCommand(
- new TargetAction(), provider, "PARKING_SERVICE_GERMAN_CITIES"
- );
- MessageHandler.getInstance().post(cmd);
- }else if(currentStage== STAGE.CAR_DECLINED_SERVICE_OR_SOFTWARE){
- ServiceActionCommand cmd = new ServiceActionCommand(
- new GoAwayAction(), provider, "PARKING_SERVICE_GERMAN_CITIES"
- );
- MessageHandler.getInstance().post(cmd);
- }
- currentStage=STAGE.CAR_PARKED;
- setUpButtons();
- }
- });
- sayGoodbye.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- MessageHandler.getInstance().sendToCarla(new CarlaMessage(6));
- currentStage=STAGE.NO_CAR_STARTED;
- setUpButtons();
- }
- });
- hack.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- if(MessageHandler.getInstance().hacked){
- //nicht mehr gehackt
- hackLabel.setText("Nicht gehackt");
- hackLabel.setTextFill(Color.web("#21a810"));
- } else{
- hackLabel.setText("Gehackt");
- hackLabel.setTextFill(Color.web("#f50000"));
- }
- MessageHandler.getInstance().hack();
- }
- });
- svProviderVerified.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- if(MessageHandler.getInstance().providerVerified){
- svProviderVerifiedLabel.setText("Nicht Verifiziert");
- svProviderVerifiedLabel.setTextFill(Color.web("#f50000"));
- } else{
- svProviderVerifiedLabel.setText("Verifiziert");
- svProviderVerifiedLabel.setTextFill(Color.web("#21a810"));
- }
- MessageHandler.getInstance().verifyProvider();
- }
- });
- suggestionReady.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent event) {
- if(!MessageHandler.getInstance().suggestionReady){
- suggestionReadyLabel.setText("Werden angezeigt");
- suggestionReadyLabel.setTextFill(Color.web("#21a810"));
- } else{
- suggestionReadyLabel.setText("Werden nicht angezeigt");
- suggestionReadyLabel.setTextFill(Color.web("#f50000"));
- }
- MessageHandler.getInstance().showSWSuggestions();
- }
- });
-
- }
-
- /**
- * Enables and disables invalid Buttons. Sets what is to happen on Action.
- */
- public void setUpButtons() {
- switch (currentStage){
- case NO_CAR_STARTED:
- setButtonVisibility(new boolean[]{true,false,false,false,false,false});
- break;
- case NO_RUNNING_SCENARIO:
- setButtonVisibility(new boolean[]{false,true,false,false,false,false});
- break;
- case NO_REGISTERED_CAR:
- setButtonVisibility(new boolean[]{false, false, true,false,false,false});
- break;
- case CAR_IN_PERCEPTION_AREA:
- setButtonVisibility(new boolean[]{false, false, false, true,false,false});
- break;
- case CAR_INSTALLING_SW:
- setButtonVisibility(new boolean[]{false,false,false,false,false,false});
- break;
- case CAR_DECLINED_SERVICE_OR_SOFTWARE:
- setButtonVisibility(new boolean[]{false,false,false, false,true,false});
- break;
- case CAR_ACCEPTED_SERVICE:
- setButtonVisibility(new boolean[]{false,false,false, false,true,false});
- break;
- case CAR_PARKED:
- setButtonVisibility(new boolean[]{false,false,false, false,false,true});
- break;
-
- default:
- break;
- }
- }
-
- private void setButtonVisibility(boolean[] b) {
- //System.err.println("Setting visibility...");
- startScenario.setDisable(!b[0]);
- driveAround.setDisable(!b[1]);
- driveIntoPerceptionAreaButton.setDisable(!b[2]);
- sendServiceRegistrationMessage.setDisable(!b[3]);
- sendServiceActionButton.setDisable(!b[4]);
- sayGoodbye.setDisable(!b[5]);
- }
-
- public void printToEnvironment(String s) {
- LogPrinter.displayInView(environmentlog, s);
- }
-
- public void setSwInstalled(){
- Platform.runLater(new Runnable() {
- @Override
- public void run() {
- swInstalled.setText("Software Installiert");
- swInstalled.setTextFill(Color.web("#21a810"));
- }
- });
- }
-}
\ No newline at end of file
diff --git a/CarControlUnit/src/GUI/Carla/CarlaView.java b/CarControlUnit/src/GUI/Carla/CarlaView.java
deleted file mode 100644
index 640c929..0000000
--- a/CarControlUnit/src/GUI/Carla/CarlaView.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package GUI.Carla;
-
-import com.airhacks.afterburner.views.FXMLView;
-//entnommen von http://afterburner.adam-bien.com/
-public class CarlaView extends FXMLView {
-}
diff --git a/CarControlUnit/src/GUI/Carla/carla.css b/CarControlUnit/src/GUI/Carla/carla.css
deleted file mode 100644
index 5192fbc..0000000
--- a/CarControlUnit/src/GUI/Carla/carla.css
+++ /dev/null
@@ -1,3 +0,0 @@
-#mainView{
-
-}
\ No newline at end of file
diff --git a/CarControlUnit/src/GUI/Carla/carla.fxml b/CarControlUnit/src/GUI/Carla/carla.fxml
deleted file mode 100644
index 101459c..0000000
--- a/CarControlUnit/src/GUI/Carla/carla.fxml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CarControlUnit/src/GUI/LogPrinter.java b/CarControlUnit/src/GUI/LogPrinter.java
deleted file mode 100644
index d6cb589..0000000
--- a/CarControlUnit/src/GUI/LogPrinter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package GUI;
-
-import javafx.application.Platform;
-import javafx.scene.Node;
-import javafx.scene.control.Label;
-import javafx.scene.control.ScrollPane;
-import javafx.scene.layout.VBox;
-import javafx.scene.text.Text;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-public class LogPrinter {
- /**
- * @author Linus Hestermeyer
- *
- * Static Utilsmethod for displaying Strings indise the passed Label. Introduced because of to much same code.
- * @param scrollPane
- * @param output
- */
- public static void displayInView(ScrollPane scrollPane, String output){
-
- Thread thread = new Thread(new Runnable() {
-
- @Override
- public void run() {
- Runnable updater = new Runnable() {
-
- @Override
- public void run() {
- Date date = new Date(System.currentTimeMillis());
-
- DateFormat formatter = new SimpleDateFormat("ss.SSS");
- formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
- VBox root = new VBox();
-
- Node old = scrollPane.getContent();
- Node newNode = new Text("\n"+formatter.format(date)+" "+output);
-
- if(old != null){
- root.getChildren().addAll(old, newNode);
- } else{
- root.getChildren().add(newNode);
- }
-
-
- scrollPane.setContent(root);
- }
- };
- Platform.runLater(updater);
-
- }
-
- });
- // don't let thread prevent JVM shutdown
- thread.setDaemon(true);
- thread.start();
-
- }
-
-}
diff --git a/CarControlUnit/src/GUI/Main/MainPresenter.java b/CarControlUnit/src/GUI/Main/MainPresenter.java
deleted file mode 100644
index b9165c4..0000000
--- a/CarControlUnit/src/GUI/Main/MainPresenter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package GUI.Main;
-
-import GUI.CCUMessageHandler.MessageHandlerPresenter;
-import GUI.Carla.CarlaPresenter;
-import GUI.Carla.CarlaView;
-import GUI.CCUMessageHandler.MessageHandlerView;
-
-import javafx.application.Platform;
-import javafx.fxml.FXML;
-import javafx.fxml.Initializable;
-import javafx.scene.layout.BorderPane;
-import javafx.stage.Stage;
-
-import java.net.URL;
-import java.util.ResourceBundle;
-
-/**
- * @author Linus Hestermeyer
- */
-public class MainPresenter implements Initializable {
-
- @FXML
- public BorderPane leftPane;
-
- @FXML
- public BorderPane rightPane;
-
- private Stage primaryStage;
- private CarlaView carlaView = new CarlaView();
- private MessageHandlerView messageHandlerView = new MessageHandlerView();
-
-
- @Override
- public void initialize(URL location, ResourceBundle resources) {
- leftPane.setCenter(messageHandlerView.getView());
- rightPane.setCenter(carlaView.getView());
-
- // entnommen von: https://www.programcreek.com/java-api-examples/?class=javafx.application.Platform&method=runLater (21.6.2020)
- Platform.runLater(() -> {
- primaryStage.setOnCloseRequest(e -> {
- Platform.exit();
- System.exit(0);
- });
- });
- }
-
- public MessageHandlerPresenter getMessageHandlerPresenter(){
- return (MessageHandlerPresenter)messageHandlerView.getPresenter();
- }
-
- public CarlaPresenter getCarlaPresenter(){
- return (CarlaPresenter)carlaView.getPresenter();
- }
-
-
- public void setStage(Stage stage){
- this.primaryStage = stage;
- }
-}
\ No newline at end of file
diff --git a/CarControlUnit/src/GUI/Main/MainView.java b/CarControlUnit/src/GUI/Main/MainView.java
deleted file mode 100644
index c35cd61..0000000
--- a/CarControlUnit/src/GUI/Main/MainView.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package GUI.Main;
-
-import com.airhacks.afterburner.views.FXMLView;
-//entnommen von http://afterburner.adam-bien.com/
-public class MainView extends FXMLView {
-}
diff --git a/CarControlUnit/src/GUI/Main/main.css b/CarControlUnit/src/GUI/Main/main.css
deleted file mode 100644
index 5192fbc..0000000
--- a/CarControlUnit/src/GUI/Main/main.css
+++ /dev/null
@@ -1,3 +0,0 @@
-#mainView{
-
-}
\ No newline at end of file
diff --git a/CarControlUnit/src/GUI/Main/main.fxml b/CarControlUnit/src/GUI/Main/main.fxml
deleted file mode 100644
index df10d46..0000000
--- a/CarControlUnit/src/GUI/Main/main.fxml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CarControlUnit/src/META-INF/MANIFEST.MF b/CarControlUnit/src/META-INF/MANIFEST.MF
deleted file mode 100644
index 3890aa1..0000000
--- a/CarControlUnit/src/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: CarControlUnitMain
-
diff --git a/CarControlUnit/src/Network/CarlaClientConnection.java b/CarControlUnit/src/Network/CarlaClientConnection.java
deleted file mode 100644
index 1b12270..0000000
--- a/CarControlUnit/src/Network/CarlaClientConnection.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package Network;
-
-import EnvironmentObjects.IConnectionClient;
-import Messages.CarlaMessage;
-import Messages.IMessage;
-import com.google.common.eventbus.EventBus;
-import org.json.JSONObject;
-
-import java.io.*;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class CarlaClientConnection implements IConnectionClient {
- private static String HOST;
- private static int PORT;
- private Socket socket;
- private ObjectOutputStream out;
- private ObjectInputStream in;
- private boolean running =false;
- private EventBus bus;
- private ServerSocket serverSocket;
-
- public CarlaClientConnection(EventBus bus) {
- this.bus=bus;
- }
-
- public boolean isRunning() {
- return running;
- }
-
-
- @Override
- public void startConnection() {
- Thread t = new Thread(() -> {
- while(true) {
-// System.err.println("Trying to read");
- try {
- Object o = in.readObject();
- System.out.println("Read object from carla: " + o);
- bus.post(o);
- } catch (IOException | ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
- });
- t.start();
- }
-
- @Override
- public void stopConnection() {
- try {
- in.close();
- out.close();
- socket.close();
- }catch (Exception e){
-
- }
- }
-
- @Override
- public void initBootstrap(String host, int port) {
- //currently not needed
- //Teile entnommen von: https://de.wikibooks.org/wiki/Java_Standard:_Socket_und_ServerSocket_(java.net)
- this.HOST=host;
- this.PORT=port;
-
- try {
- serverSocket= new ServerSocket(PORT);
- System.err.println("Opened up port "+ PORT + " for CarlaConnection: ");
- } catch (Exception e){
- e.printStackTrace();
- }
-
- new Thread(){
- @Override
- public void run() {
- while(!running) {
- try {
- socket = serverSocket.accept();
- System.err.println("Carla connection successful!");
- running = true;
- out = new ObjectOutputStream(socket.getOutputStream()); // get the output stream of client.
- System.err.println("ObjectOutputStream Carla created");
- in = new ObjectInputStream(socket.getInputStream()); // get the input stream of client.
- System.err.println("ObjectInputStream Carla created");
- startConnection();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }.start();
-
-
- }
-
- @Override
- public void sendMessage(IMessage out) {
- //Teile entnommen aus: https://stackoverflow.com/questions/30186343/passing-java-object-to-python
- if(this.out != null) {
- JSONObject obj = new JSONObject();
- if(out instanceof CarlaMessage){
- CarlaMessage carlaMessage= (CarlaMessage) out;
- obj.put("action", carlaMessage.getAction());
- }
- StringWriter writer = new StringWriter();
- obj.write(writer);
-
- try {
- //System.err.println("Trying to send an JSON Object.");
- this.out.writeObject(writer.toString());
- this.out.flush();
- System.err.println("Sent to Carla: "+writer.toString());
- } catch (IOException e) {
- e.printStackTrace();
- }
- } else{
- System.err.println("Carla not connected - what a bummer.");
- }
- }
-}
diff --git a/CarControlUnit/src/Network/MMSClientConnection.java b/CarControlUnit/src/Network/MMSClientConnection.java
deleted file mode 100644
index 5e85f20..0000000
--- a/CarControlUnit/src/Network/MMSClientConnection.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package Network;
-
-import EnvironmentObjects.IConnectionClient;
-import Messages.IMessage;
-import com.google.common.eventbus.EventBus;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class MMSClientConnection implements IConnectionClient {
- private static String HOST;
- private static int PORT;
- private Socket socket;
- private ObjectOutputStream out;
- private ObjectInputStream in;
- private boolean running =false;
- private EventBus bus;
- private ServerSocket serverSocket;
-
- public MMSClientConnection(EventBus bus) {
- this.bus=bus;
- }
-
- public boolean isRunning() {
- return running;
- }
-
- @Override
- public void startConnection() {
- Thread t = new Thread(() -> {
- while(isRunning()) {
- //System.err.println("Trying to read");
- try {
- Object o = in.readObject();
- System.out.println("Read Message from MMS: " + o);
- bus.post(o);
- } catch (IOException | ClassNotFoundException e) {
- running=false;
- e.printStackTrace();
- }
- }
- //stopConnection();
- //startConnection();
- });
- t.start();
- }
-
- @Override
- public void stopConnection() {
- try {
- in.close();
- out.close();
- socket.close();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
-
- @Override
- public void initBootstrap(String host, int port) {
- this.HOST=host;
- this.PORT=port;
-
- //Teile entnommen von: https://de.wikibooks.org/wiki/Java_Standard:_Socket_und_ServerSocket_(java.net)
- try {
- serverSocket= new ServerSocket(PORT);
- System.err.println("Opened up port "+ PORT + " for MMSConnection: ");
- } catch (Exception e){
- e.printStackTrace();
- }
-
- new Thread(){
- @Override
- public void run() {
- while(!running) {
- try {
- socket = serverSocket.accept();
- System.err.println("MMS connection successful!");
- running = true;
- out = new ObjectOutputStream(socket.getOutputStream()); // get the output stream of client.
- System.err.println("ObjectOutputStream MMS created");
- in = new ObjectInputStream(socket.getInputStream()); // get the input stream of client.
- System.err.println("ObjectInputStream MMS created");
- startConnection();
- } catch (IOException e) {
- e.printStackTrace();
- running=false;
- }
- }
- }
- }.start();
-
- }
-
- @Override
- public void sendMessage(IMessage out) {
- //Teile entnommen von: https://de.wikibooks.org/wiki/Java_Standard:_Socket_und_ServerSocket_(java.net)
- if(this.out != null) {
- try {
- this.out.writeObject(out);
- this.out.flush();
- System.err.println("Sent to MMS: "+out);;
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- } else{
- System.err.println("MMS not connected - what a bummer.");
- }
- }
-}
\ No newline at end of file
diff --git a/CarControlUnit/src/Network/NetworkConfig.java b/CarControlUnit/src/Network/NetworkConfig.java
deleted file mode 100644
index 3c26bc5..0000000
--- a/CarControlUnit/src/Network/NetworkConfig.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package Network;
-
-
-/**
- * This class provides a collection of static variables which are used for configuration purposes.
- *
- * @version 1.0
- * @author Linus Hestermeyer
- *
- */
-public class NetworkConfig {
- public static final String serverUrl = "127.0.0.1";
- public static final int serverPort = 48120;
-
-}
diff --git a/CarControlUnit/src/Network/OEMVerificationServerConnection/INettyClient.java b/CarControlUnit/src/Network/OEMVerificationServerConnection/INettyClient.java
deleted file mode 100644
index c02b41c..0000000
--- a/CarControlUnit/src/Network/OEMVerificationServerConnection/INettyClient.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package Network.OEMVerificationServerConnection;
-
-import Messages.IMessage;
-
-/**
- * The interface for the NettyClient initialization
- *
- * @author Linus Hestermeyer
- */
-public interface INettyClient {
-
- /**
- * Starts the Connection with the Server. Also inits channelread, send etc for Ports.
- */
- void startConnection();
-
- /**
- * Cancels the connection with the Server
- */
- void stopConnection();
-
-
- /**
- * Creates the netty-Bootstrap which creates the connection.
- *
- * @param host serverhost
- * @param port serverport
- */
- void initBootstrap(String host, int port);
-
-
- /**
- * Send a message from the ControlUnit to the Server
- *
- * @param out message
- */
- void sendMessage(IMessage out);
-}
diff --git a/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyClientHandler.java b/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyClientHandler.java
deleted file mode 100644
index 4e166f9..0000000
--- a/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyClientHandler.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package Network.OEMVerificationServerConnection;
-
-import Messages.IMessage;
-import io.netty.channel.ChannelHandlerAdapter;
-import io.netty.channel.ChannelHandlerContext;
-
-
-/**
- * Handles Netty-Initialization.Network.Events (i.e. messages, connection status etc.).
- *
- * @author Linus Hestermeyer
- *
- * Teile entnommen von: https://netty.io/wiki/user-guide-for-5.x.html
- */
-
-public class NettyClientHandler extends ChannelHandlerAdapter {
- private NettyConnectionClient nettyClient;
-
- /**
- * Constructor, which injects the nettyclient.
- *
- * @param nettyClient NettyClient-Instance
- */
- public NettyClientHandler(NettyConnectionClient nettyClient)
- {
- this.nettyClient = nettyClient;
- }
-
-
- /**
- * Method which automatically gets called at start of a connection.
- *
- * @param ctx connection-context
- */
- @Override
- public void channelActive(ChannelHandlerContext ctx) { }
-
- /**
- * Method which handles incoming messages.
- *
- * @param ctx connection-context
- * @param msg incoming message
- *
- */
- @Override
- public void channelRead(ChannelHandlerContext ctx, Object msg) {
- //System.out.println("Recieved a Message! "+msg);
- this.nettyClient.receivedMessage((IMessage)msg);
- }
-
-
- /**
- * Gets called when last Message of channelRead got read.
- *
- * @param ctx connection-context
- */
- @Override
- public void channelReadComplete(ChannelHandlerContext ctx) {
- ctx.flush();
- }
-
-
- /**
- * Gets called when the connection is inactive or if the connection ran out.
- *
- * @param ctx connection-context
- */
- @Override
- public void channelInactive(ChannelHandlerContext ctx) throws Exception {
- this.nettyClient.connectionInterrupted();
- ctx.fireChannelInactive();
- }
-
-
- /**
- * Gets called if unhandled Exception occurs in connection-context.
- * *
- * @param ctx connection-context
- * @param cause exception
- *
- */
- @Override
- public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
- // Close the connection when an exception is raised.
- cause.printStackTrace();
- ctx.close();
- }
-}
diff --git a/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyClientInitializer.java b/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyClientInitializer.java
deleted file mode 100644
index 33ac313..0000000
--- a/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyClientInitializer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package Network.OEMVerificationServerConnection;
-
-
-/**
- * Initializes the Netty-Instance and the ServerConnection.
- *
- * @author Linus Hestermeyer
- *
- * Teile entnommen von: https://netty.io/wiki/user-guide-for-5.x.html
- */
-public class NettyClientInitializer {
-
- private final INettyClient iNettyClient;
-
- /**
- * Constructor, which injects the nettyclient.
- *
- * @param iNettyClient nettyCLient
- */
- public NettyClientInitializer(INettyClient iNettyClient)
- {
- this.iNettyClient = iNettyClient;
- }
-
- /**
- *
- * Calles the needed methods from the nettyClient.
- *
- * @param host serverhost
- * @param port serverport
- *
- * @return nettyClient after successfully building the connection
- */
- public INettyClient createNettyClientConnection(String host, int port)
- {
- this.iNettyClient.initBootstrap(host, port);
- this.iNettyClient.startConnection();
-
- return iNettyClient;
- }
-
-}
diff --git a/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyConnectionClient.java b/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyConnectionClient.java
deleted file mode 100644
index 4093697..0000000
--- a/CarControlUnit/src/Network/OEMVerificationServerConnection/NettyConnectionClient.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package Network.OEMVerificationServerConnection;
-
-import Messages.IMessage;
-import com.google.common.eventbus.EventBus;
-import io.netty.bootstrap.Bootstrap;
-import io.netty.channel.*;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.handler.codec.serialization.ClassResolvers;
-import io.netty.handler.codec.serialization.ObjectDecoder;
-import io.netty.handler.codec.serialization.ObjectEncoder;
-import io.netty.handler.logging.LogLevel;
-import io.netty.handler.logging.LoggingHandler;
-
-import java.util.Properties;
-
-
-/**
- * handles the networks connections as well as incoming & outgoing messages.
- *
- * @author Linus Hestermeyer
- *
- * Teile entnommen von: https://netty.io/wiki/user-guide-for-5.x.html
- */
-public class NettyConnectionClient implements INettyClient {
- static String HOST;
- static int PORT;
-
- private Properties properties;
- private Channel channel;
- private EventLoopGroup eventLoopGroup;
- private Bootstrap bootstrap;
- private ChannelFuture future;
- private EventBus eventBus;
-
- private boolean connectionSuccess;
-
- /**
- * Constructor inits the needed attributes for building a network connection.
- *
- * @param eventBus bus
- */
- public NettyConnectionClient(EventBus eventBus) {
- this.eventLoopGroup = new NioEventLoopGroup();
- this.bootstrap = new Bootstrap();
- this.eventBus= eventBus;
- }
-
-
- /**
- * Initializes bootstrap for the server connection
- *
- * @param host serverhost
- * @param port serverport
- */
- public void initBootstrap(String host, int port) {
- try {
- this.HOST = host;
- this.PORT = port;
- this.bootstrap.group(this.eventLoopGroup)
- .channel(NioSocketChannel.class)
- .option(ChannelOption.TCP_NODELAY, true)
- .remoteAddress(host, port)
- .handler(new LoggingHandler(LogLevel.DEBUG))
- .handler(new ChannelInitializer() {
- @Override
- public void initChannel(SocketChannel ch) {
- ChannelPipeline p = ch.pipeline();
- p.addLast(new ObjectEncoder());
- p.addLast(new ObjectDecoder(9048576 ,ClassResolvers.cacheDisabled(null)));
- p.addLast(new NettyClientHandler(NettyConnectionClient.this));
- }
- });
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Baut den Channel zum Server auf.
- *
- * Bevor diese Methode aufgerufen werden sollte, muss initBootstrap() aufgerufen worden sein.
- *
- */
- public void startConnection() {
- System.err.println("Trying to connect to server...");
- try {
- this.future = bootstrap.connect(this.HOST, this.PORT).sync();
- //this.future.channel().closeFuture().sync();
- System.err.println("[Netty] Connected to localhost:" + PORT + ".");
- this.connectionSuccess = true;
- }
- catch (Exception e) {
- System.err.println("Connection couldn't be built.");
- this.connectionSuccess = false;
- }
- }
-
-
- /**
- * Stopt die Verbindung zum Server
- *
- */
- public void stopConnection()
- {
- this.eventLoopGroup.shutdownGracefully();
- }
-
-
- /**
- * Wird ausgefuehrt wenn die Verbindung unplanmäßig unterbrochen wird.
- *
- */
- public void connectionInterrupted()
- {
- System.err.println("Server not available");
- }
-
-
- /**
- * Eingehende Messages werden von hier auf den Eventbus geschrieben.
- *
- * @param in Die eingehende Nachricht vom Server
- */
- public void receivedMessage(IMessage in)
- {
- this.eventBus.post(in);
- }
-
-
- /**
- * Ausgehende Nachrichten werden ueber diese Methode an den Server übermittelt.
- *
- * @param out Eine Nachricht für den Server
- */
- public void sendMessage(IMessage out)
- {
- try {
- //System.err.println("trying to send message " + out);
- this.future.channel().writeAndFlush(out);
- //System.err.println("SUCCESS");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
-
- /**
- *
- * Gibt true zurück wenn Connection erfolgreich aufgebaut wurde.
- *
- * @return connectionSuccess
- *
- * */
- public boolean isConnectionSuccess() {
- return connectionSuccess;
- }
-}
diff --git a/Common/pom.xml b/Common/pom.xml
deleted file mode 100644
index e80d0c5..0000000
--- a/Common/pom.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- 4.0.0
-
-
- linushestermeyer
- bachelorthesis-java
- 1.0-SNAPSHOT
-
-
- linushestermeyer
- Common
- 1.0-SNAPSHOT
- jar
-
-
-
\ No newline at end of file
diff --git a/Common/src/Actions/GoAwayAction.java b/Common/src/Actions/GoAwayAction.java
deleted file mode 100644
index 2119647..0000000
--- a/Common/src/Actions/GoAwayAction.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package Actions;
-
-/**
- * @author Linus Hestermeyer
- *
- * Action, which gives the car a new target to reach.
- */
-public class GoAwayAction implements IAction {
-}
diff --git a/Common/src/Actions/IAction.java b/Common/src/Actions/IAction.java
deleted file mode 100644
index a7162fb..0000000
--- a/Common/src/Actions/IAction.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package Actions;
-
-import java.io.Serializable;
-
-public interface IAction extends Serializable {
-}
diff --git a/Common/src/Actions/MovementHintAction.java b/Common/src/Actions/MovementHintAction.java
deleted file mode 100644
index 6a5cf5e..0000000
--- a/Common/src/Actions/MovementHintAction.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package Actions;
-
-/**
- * @author Linus Hestermeyer
- *
- * Action, which provides hints for the cars movement planning. This can be a countdown provided by a trafficlight, when this will turn green.
- */
-public class MovementHintAction implements IAction {
-
-}
diff --git a/Common/src/Actions/TargetAction.java b/Common/src/Actions/TargetAction.java
deleted file mode 100644
index 529a706..0000000
--- a/Common/src/Actions/TargetAction.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package Actions;
-
-/**
- * @author Linus Hestermeyer
- *
- * Action, which gives the car a new target to reach.
- */
-public class TargetAction implements IAction {
-}
diff --git a/Common/src/EnvironmentObjects/Angebot.java b/Common/src/EnvironmentObjects/Angebot.java
deleted file mode 100644
index 262f9c9..0000000
--- a/Common/src/EnvironmentObjects/Angebot.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package EnvironmentObjects;
-
-import java.io.Serializable;
-
-/**
- *
- */
-public class Angebot implements Serializable {
- private double pricePerUnit;
- /*
- Service
- PricePerUnit
- */
-
- public Angebot(double pricePerUnit) {
- this.pricePerUnit = pricePerUnit;
- }
-
- public double getPricePerUnit() {
- return pricePerUnit;
- }
-
- public void setPricePerUnit(double pricePerUnit) {
- this.pricePerUnit = pricePerUnit;
- }
-}
diff --git a/Common/src/EnvironmentObjects/Description.java b/Common/src/EnvironmentObjects/Description.java
deleted file mode 100644
index 1ea9054..0000000
--- a/Common/src/EnvironmentObjects/Description.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package EnvironmentObjects;
-
-import Actions.IAction;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-/**
- * @author Linus Hestermeyer
- *
- * Description of a Service.
- */
-public class Description implements Serializable {
- private String title;
- private String description;
- private ArrayList buzzwords;
- private ArrayList angebote;
- private ArrayList angebotTitel;
- private ArrayList actionTypes;
-
- public Description(String title, String description, ArrayList buzzwords, ArrayList angebote,ArrayList angebotTitel, ArrayList actionTypes) {
- this.title = title;
- this.description = description;
- this.buzzwords = buzzwords;
- this.angebote = angebote;
- this.angebotTitel=angebotTitel;
- this.actionTypes = actionTypes;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String serviceTitle) {
- this.title = serviceTitle;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String serviceDescription) {
- this.description = serviceDescription;
- }
-
- public ArrayList getBuzzwords() {
- return buzzwords;
- }
-
- public void setBuzzwords(ArrayList serviceBuzzwords) {
- this.buzzwords = serviceBuzzwords;
- }
-
- public ArrayList getActionTypes() {
- return actionTypes;
- }
-
- public void setActionTypes(ArrayList actionTypes) {
- this.actionTypes = actionTypes;
- }
-
- public ArrayList getAngebote() {
- return angebote;
- }
-
- public void setAngebote(ArrayList angebote) {
- this.angebote = angebote;
- }
-
- public ArrayList getAngebotTitel() {
- return angebotTitel;
- }
-
- public void setAngebotTitel(ArrayList angebotTitel) {
- this.angebotTitel = angebotTitel;
- }
-}
diff --git a/Common/src/EnvironmentObjects/IConnectionClient.java b/Common/src/EnvironmentObjects/IConnectionClient.java
deleted file mode 100644
index bcd31d8..0000000
--- a/Common/src/EnvironmentObjects/IConnectionClient.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package EnvironmentObjects;
-
-import Messages.IMessage;
-
-/**
- * The interface for the NettyClient initialization
- *
- * @author Linus Hestermeyer
- */
-public interface IConnectionClient {
- /**
- * Starts the Connection with the Server. Also inits channelread, send etc for Ports.
- */
- void startConnection();
-
- /**
- * Cancels the connection with the Server
- */
- void stopConnection();
-
-
- /**
- * Creates the netty-Bootstrap which creates the connection.
- *
- * @param host serverhost
- * @param port serverport
- */
- void initBootstrap(String host, int port);
-
-
- /**
- * Send a message from the ControlUnit to the Server
- *
- * @param out message
- */
- void sendMessage(IMessage out);
-}
diff --git a/Common/src/EnvironmentObjects/Provider.java b/Common/src/EnvironmentObjects/Provider.java
deleted file mode 100644
index f3156c0..0000000
--- a/Common/src/EnvironmentObjects/Provider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package EnvironmentObjects;
-
-import java.io.Serializable;
-
-public class Provider implements Serializable {
- private String publicProviderID;
- private String providerName;
- private String providerURL;
-
- public Provider(String publicProviderID, String providerName, String providerURL) {
- this.publicProviderID = publicProviderID;
- this.providerName = providerName;
- this.providerURL = providerURL;
- }
-
- public String getPublicProviderID() {
- return publicProviderID;
- }
-
- public void setPublicProviderID(String publicProviderID) {
- this.publicProviderID = publicProviderID;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
- public void setProviderName(String providerName) {
- this.providerName = providerName;
- }
-
- public String getProviderURL() {
- return providerURL;
- }
-
- public void setProviderURL(String providerURL) {
- this.providerURL = providerURL;
- }
-}
diff --git a/Common/src/EnvironmentObjects/Software/ISoftware.java b/Common/src/EnvironmentObjects/Software/ISoftware.java
deleted file mode 100644
index 6fa5a24..0000000
--- a/Common/src/EnvironmentObjects/Software/ISoftware.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package EnvironmentObjects.Software;
-
-import Messages.IMessage;
-
-import java.io.Serializable;
-
-public interface ISoftware extends Serializable {
- /**
- * This message is implemented by every created software. The software needs to further decide on what to happen with specific messages.
- * @param msg
- */
- void handleMessage(IMessage msg);
-}
diff --git a/Common/src/EnvironmentObjects/Software/ParkingServiceSoftware.java b/Common/src/EnvironmentObjects/Software/ParkingServiceSoftware.java
deleted file mode 100644
index ff662b7..0000000
--- a/Common/src/EnvironmentObjects/Software/ParkingServiceSoftware.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package EnvironmentObjects.Software;
-
-import Actions.GoAwayAction;
-import Actions.IAction;
-import Actions.MovementHintAction;
-import Actions.TargetAction;
-import EnvironmentObjects.*;
-import Messages.*;
-
-import java.util.ArrayList;
-
-/**
- * With this Software, simulated cars are supposed to park in a specific location.
- *
- * @version 1.0
- * @author Linus Hestermeyer
- */
-public class ParkingServiceSoftware extends Software {
- public static final String SOFTWARE_ID = "PARKING_SERVICE_GERMAN_CITIES";
- private static final Provider PROVIDER = new Provider("GER_PARK", "Parken in Deutschland GmbH", "linushestermeyer.de");
- private static final String NAME = "Parken in Deutschland";
- private static final String DESCRIPTION = "Mit dieser Software kann in jeder Stadt Deutschlands auf städtischen Parkplätzen geparkt werden." +
- "\n Berechtigungen: Zieleingabe, V2X-Kommunikation" +
- "\n Kennzahlen: 5000 tägliche Verwendungen im Umkreis von 10km der aktuellen Position.";
-
- private static final ArrayList ANGEBOT_TITEL=new ArrayList(){
- {
- add("Kauf");
- add("Leihe für 6 Monate");
- add("Monatsabo");
- }
- };
-
- private static final ArrayList ANGEBOTE=new ArrayList(){
- {
- add(new Angebot(49.99)); //Kauf
- add(new Angebot(22.50)); //Leihe für 6 Monate
- add(new Angebot(4.99)); //Abo für 1 Monat
- }
- };
- private static final ArrayList ACTIONTYPES=new ArrayList(){
- {
- add(new MovementHintAction());
- add(new TargetAction());
- }
- };
- private static final ArrayList BUZZWORDS=new ArrayList(){
- {
- add("Parken");
- add("Deutschland");
- add("Überall");
- add("Günstig");
- }
- };
- private static final ArrayList VERIFIEDPROVIDERS = new ArrayList(){
- {
- add(new Provider("ger_park_328_nds", "Parken in Oldenburg", "parken.stadt-oldenburg.de"));
- }
- };
-
- public static final int VERSION = 1;
-
- public ParkingServiceSoftware() {
- super(SOFTWARE_ID, PROVIDER, new Description(
- NAME,
- DESCRIPTION,
- BUZZWORDS,
- ANGEBOTE,
- ANGEBOT_TITEL,
- ACTIONTYPES
- ),
- VERIFIEDPROVIDERS,
- VERSION
- );
- }
-
- @Override
- public void handleMessage(IMessage msg) {
- if(msg instanceof ServiceRegistrationMessage){
- handleServiceRegistration((ServiceRegistrationMessage)msg);
- }else if(msg instanceof ServiceDecisionMessage){
- handleServiceDecisionMessage((ServiceDecisionMessage)msg);
- }else if(msg instanceof ServiceActionCommand){
- handleServiceActionCommand((ServiceActionCommand)msg);
- }
- }
-
- /**
- * Puts the ServiceAngebot onto the MMS together with desciption etc
- * @param msg
- */
- private void handleServiceRegistration(ServiceRegistrationMessage msg){
- msg.setInstallSW(false);
- getMmsConnection().sendMessage(msg);
- }
-
- /**
- * Forwards the msg to Carla-Actor. In return we expect a ServiceActionCommand
- * @param msg
- */
- private void handleServiceDecisionMessage(ServiceDecisionMessage msg){
- if(msg.isAccepted()){
- getCarlaConnection().sendMessage(new CarlaMessage(4));
- }
-
- }
-
- /**
- * Forwards the ServiceActionMessage to MMS and Carla-Car.
- * @param msg
- */
- private void handleServiceActionCommand(ServiceActionCommand msg){
- getMmsConnection().sendMessage(msg);
-
- }
-}
diff --git a/Common/src/EnvironmentObjects/Software/Software.java b/Common/src/EnvironmentObjects/Software/Software.java
deleted file mode 100644
index c636f6c..0000000
--- a/Common/src/EnvironmentObjects/Software/Software.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package EnvironmentObjects.Software;
-
-import EnvironmentObjects.IConnectionClient;
-import EnvironmentObjects.Description;
-import EnvironmentObjects.Provider;
-
-import java.util.ArrayList;
-
-public abstract class Software implements ISoftware {
- private String softwareID;
- private Provider provider;
- private Description description;
- private IConnectionClient mmsConnection;
- private IConnectionClient carlaConnection;
- private IConnectionClient swsConnection;
- private ArrayList verifiedServiceProviders;
- private int version;
-
- public Software(String softwareID, Provider provider, Description description, ArrayList verifiedServiceProviders, int version) {
- this.softwareID = softwareID;
- this.description= description;
- this.provider=provider;
- this.verifiedServiceProviders = verifiedServiceProviders;
- this.version=version;
- }
-
- public String getSoftwareID() {
- return softwareID;
- }
-
- public void setSoftwareID(String softwareID) {
- this.softwareID = softwareID;
- }
-
- public Description getDescription() {
- return description;
- }
-
- public void setDescription(Description description) {
- this.description = description;
- }
-
- public IConnectionClient getMmsConnection() {
- return mmsConnection;
- }
-
- public void setMmsConnection(IConnectionClient mmsConnection) {
- this.mmsConnection = mmsConnection;
- }
-
- public IConnectionClient getCarlaConnection() {
- return carlaConnection;
- }
-
- public void setCarlaConnection(IConnectionClient carlaConnection) {
- this.carlaConnection = carlaConnection;
- }
-
- public IConnectionClient getSwsConnection() {
- return swsConnection;
- }
-
- public void setSwsConnection(IConnectionClient swsConnection) {
- this.swsConnection = swsConnection;
- }
- public boolean isUpTpDate(){
- return true;
- }
-
- public Provider getProvider() {
- return provider;
- }
-
- public void setProvider(Provider provider) {
- this.provider = provider;
- }
-
- public ArrayList getVerifiedServiceProviders() {
- return verifiedServiceProviders;
- }
-
- public void setVerifiedServiceProviders(ArrayList verifiedServiceProviders) {
- this.verifiedServiceProviders = verifiedServiceProviders;
- }
-
- public int getVersion() {
- return version;
- }
-
- public void setVersion(int version) {
- this.version = version;
- }
-}
diff --git a/Common/src/Messages/CarlaMessage.java b/Common/src/Messages/CarlaMessage.java
deleted file mode 100644
index 3b9e9a8..0000000
--- a/Common/src/Messages/CarlaMessage.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package Messages;
-
-public class CarlaMessage extends Message {
- private int action;
-
- public CarlaMessage(int action) {
- this.action = action;
- }
-
- public int getAction() {
- return action;
- }
-
- public void setAction(int action) {
- this.action = action;
- }
-}
diff --git a/Common/src/Messages/FillShopMessage.java b/Common/src/Messages/FillShopMessage.java
deleted file mode 100644
index b659db9..0000000
--- a/Common/src/Messages/FillShopMessage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Software.Software;
-
-import java.util.ArrayList;
-
-public class FillShopMessage extends Message {
- private ArrayList softwares;
- private ArrayList advertisedSoftwares;
-
- public FillShopMessage(ArrayList softwares, ArrayList advertisedSoftwares) {
- this.softwares = softwares;
- this.advertisedSoftwares = advertisedSoftwares;
- }
-
- public ArrayList getSoftwares() {
- return softwares;
- }
-
- public void setSoftwares(ArrayList softwares) {
- this.softwares = softwares;
- }
-
- public ArrayList getAdvertisedSoftwares() {
- return advertisedSoftwares;
- }
-
- public void setAdvertisedSoftwares(ArrayList advertisedSoftwares) {
- this.advertisedSoftwares = advertisedSoftwares;
- }
-}
diff --git a/Common/src/Messages/IMessage.java b/Common/src/Messages/IMessage.java
deleted file mode 100644
index 5953acb..0000000
--- a/Common/src/Messages/IMessage.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package Messages;
-
-import io.netty.channel.ChannelHandlerContext;
-
-import java.io.Serializable;
-
-public interface IMessage extends Serializable {
-
- //Get ChannelContext from Message
- public Object getCtx();
-
- //Add ChannelContext to Message
- public void setCtx(ChannelHandlerContext ctx);
-}
diff --git a/Common/src/Messages/Message.java b/Common/src/Messages/Message.java
deleted file mode 100644
index dd94cdc..0000000
--- a/Common/src/Messages/Message.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package Messages;
-
-import io.netty.channel.ChannelHandlerContext;
-
-abstract public class Message implements IMessage {
-
- ChannelHandlerContext ctx = null;
-
- @Override
- public ChannelHandlerContext getCtx() {
- return this.ctx;
- }
-
- @Override
- public void setCtx(ChannelHandlerContext ctx) {
- this.ctx = ctx;
- }
-}
diff --git a/Common/src/Messages/ServiceActionCommand.java b/Common/src/Messages/ServiceActionCommand.java
deleted file mode 100644
index 03dee98..0000000
--- a/Common/src/Messages/ServiceActionCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package Messages;
-
-import Actions.IAction;
-import EnvironmentObjects.Provider;
-
-/**
- *
- */
-public class ServiceActionCommand extends ServiceMessage {
- //private ActionEnums action;
- private IAction action;
-
- public ServiceActionCommand(IAction action, Provider provider, String requiredSWID) {
- super(provider, requiredSWID);
- this.action = action;
-
- }
-
- public IAction getAction() {
- return action;
- }
-
- public void setAction(IAction action) {
- this.action = action;
- }
-
-}
\ No newline at end of file
diff --git a/Common/src/Messages/ServiceActionMessage.java b/Common/src/Messages/ServiceActionMessage.java
deleted file mode 100644
index c54b33e..0000000
--- a/Common/src/Messages/ServiceActionMessage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package Messages;
-import Actions.IAction;
-import EnvironmentObjects.Provider;
-
-/**
- * @author Linus Hestermeyer
- *
- * Message which contains the action the car is supposed to do.
- */
-public class ServiceActionMessage extends ServiceMessage {
- private IAction action;
-
- public ServiceActionMessage(IAction action, Provider provider, String requiredSWID) {
- super(provider, requiredSWID);
- this.action=action;
- }
-
- public IAction getAction() {
- return action;
- }
-
- public void setAction(IAction action) {
- this.action = action;
- }
-
-}
diff --git a/Common/src/Messages/ServiceDecisionMessage.java b/Common/src/Messages/ServiceDecisionMessage.java
deleted file mode 100644
index b68d82f..0000000
--- a/Common/src/Messages/ServiceDecisionMessage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Provider;
-
-/**
- * @author Linus Hestermeyer
- *
- * Tells if driver accepted to use the inquiried service or not.
- */
-public class ServiceDecisionMessage extends ServiceMessage {
-
- private long inquiryID;
- private boolean accepted;
-
- public ServiceDecisionMessage(long inquiryID, boolean accepted, Provider provider,String requiredSWID) {
- super(provider, requiredSWID);
- this.inquiryID=inquiryID;
- this.accepted=accepted;
- }
-
- public long getInquiryID() {
- return inquiryID;
- }
-
- public void setInquiryID(long inquiryID) {
- this.inquiryID = inquiryID;
- }
-
- public boolean isAccepted() {
- return accepted;
- }
-
- public void setAccepted(boolean accepted) {
- this.accepted = accepted;
- }
-}
diff --git a/Common/src/Messages/ServiceMessage.java b/Common/src/Messages/ServiceMessage.java
deleted file mode 100644
index 2e3fd96..0000000
--- a/Common/src/Messages/ServiceMessage.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Provider;
-
-public class ServiceMessage extends Message {
- /**
- * Gets used from the Software so that this knows what to do.
- */
- private Provider provider;
- private String requiredSWID;
-
- public ServiceMessage(Provider provider, String requiredSWID) {
- this.provider = provider;
- this.requiredSWID=requiredSWID;
- }
-
- public Provider getProvider() {
- return provider;
- }
-
- public void setProvider(Provider provider) {
- this.provider = provider;
- }
-
- public String getRequiredSWID() {
- return requiredSWID;
- }
-
- public void setRequiredSWID(String requiredSWID) {
- this.requiredSWID = requiredSWID;
- }
-}
diff --git a/Common/src/Messages/ServiceRegistrationMessage.java b/Common/src/Messages/ServiceRegistrationMessage.java
deleted file mode 100644
index d0f76ab..0000000
--- a/Common/src/Messages/ServiceRegistrationMessage.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package Messages;
-import EnvironmentObjects.Description;
-import EnvironmentObjects.Provider;
-
-/**
- * @author Linus Hestermeyer
- *
- *
- * Muss:
- * Software für Service vorstellen
- * Kosten des ServiceProviders aufzeigen -> elternklasse: Angebot
- *
- * The request the actor(i.e. parking-validator / traffic light) sends to the car in order to propose the use of its service.
- */
-public class ServiceRegistrationMessage extends ServiceMessage{
- private Description description;
- private long inquiryID;
- private boolean installSW;
-
- public ServiceRegistrationMessage(Description description, long inquiryID, Provider provider, String requiredSWID) {
- super(provider, requiredSWID);
- this.description = description;
- this.inquiryID = inquiryID;
- }
-
- public Description getDescription() {
- return description;
- }
-
- public void setDescription(Description description) {
- this.description = description;
- }
-
- public long getInquiryID() {
- return inquiryID;
- }
-
- public void setInquiryID(long inquiryID) {
- this.inquiryID = inquiryID;
- }
-
- public boolean isInstallSW() {
- return installSW;
- }
-
- public void setInstallSW(boolean installSW) {
- this.installSW = installSW;
- }
-}
diff --git a/Common/src/Messages/SoftwareContentMessage.java b/Common/src/Messages/SoftwareContentMessage.java
deleted file mode 100644
index 1a46842..0000000
--- a/Common/src/Messages/SoftwareContentMessage.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Description;
-import EnvironmentObjects.Provider;
-
-import java.util.ArrayList;
-
-public class SoftwareContentMessage extends SoftwareMessage {
- private Description desc;
- private boolean verified;
- private long inquiryID;
- private ArrayList verifiedProviders;
- //TODO: look, what other UPTANE features can be integrated
-
- public SoftwareContentMessage(Description desc, boolean verified, long inquiryID, Provider provider, String reqSWID, ArrayList verifiedProviders) {
- super(reqSWID,provider);
- this.desc = desc;
- this.verified = verified;
- this.inquiryID=inquiryID;
- this.verifiedProviders=verifiedProviders;
- }
-
- public Description getDesc() {
- return desc;
- }
-
- public void setDesc(Description desc) {
- this.desc = desc;
- }
-
- public boolean isVerified() {
- return verified;
- }
-
- public void setVerified(boolean verified) {
- this.verified = verified;
- }
-
- public long getInquiryID() {
- return inquiryID;
- }
-
- public void setInquiryID(long inquiryID) {
- this.inquiryID = inquiryID;
- }
-
-
- public ArrayList getVerifiedProviders() {
- return verifiedProviders;
- }
-
- public void setVerifiedProviders(ArrayList verifiedProviders) {
- this.verifiedProviders = verifiedProviders;
- }
-}
diff --git a/Common/src/Messages/SoftwareContentRequest.java b/Common/src/Messages/SoftwareContentRequest.java
deleted file mode 100644
index 82d987e..0000000
--- a/Common/src/Messages/SoftwareContentRequest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package Messages;
-import EnvironmentObjects.Description;
-import EnvironmentObjects.Provider;
-
-public class SoftwareContentRequest extends SoftwareMessage{
- private Description description;
- private long inquiryID;
-
- /**
- *
- * @param description
- * @param provider Is a ServiceProvider
- * @param inquiryID
- * @param requiredSWID
- */
- public SoftwareContentRequest(Description description, Provider provider, long inquiryID, String requiredSWID) {
- super(requiredSWID, provider);
- this.description = description;
- this.inquiryID=inquiryID;
- }
-
- public Description getDescription() {
- return description;
- }
-
- public void setDescription(Description description) {
- this.description = description;
- }
-
- public long getInquiryID() {
- return inquiryID;
- }
-
- public void setInquiryID(long inquiryID) {
- this.inquiryID = inquiryID;
- }
-}
diff --git a/Common/src/Messages/SoftwareDecisionMessage.java b/Common/src/Messages/SoftwareDecisionMessage.java
deleted file mode 100644
index 1648234..0000000
--- a/Common/src/Messages/SoftwareDecisionMessage.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Provider;
-
-public class SoftwareDecisionMessage extends SoftwareMessage {
-
- private long inquiryID;
- private boolean accepted;
-
- public SoftwareDecisionMessage(long inquiryID, boolean accepted, String softwareID, Provider provider) {
- super(softwareID,provider);
- this.inquiryID=inquiryID;
- this.accepted=accepted;
-
- }
-
- public long getInquiryID() {
- return inquiryID;
- }
-
- public void setInquiryID(long inquiryID) {
- this.inquiryID = inquiryID;
- }
-
- public boolean isAccepted() {
- return accepted;
- }
-
- public void setAccepted(boolean accepted) {
- this.accepted = accepted;
- }
-}
diff --git a/Common/src/Messages/SoftwareDeleteMessage.java b/Common/src/Messages/SoftwareDeleteMessage.java
deleted file mode 100644
index 02bfb23..0000000
--- a/Common/src/Messages/SoftwareDeleteMessage.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package Messages;
-
-
-import EnvironmentObjects.Provider;
-
-/**
- * @author Linus Hestermeyer
- *
- * Message, which is sent if the driver unsubscribes the service.
- */
-public class SoftwareDeleteMessage extends SoftwareMessage{
- private long carID;
-
- public SoftwareDeleteMessage(long carID, String softwareID, Provider provider) {
- super(softwareID,provider);
- this.carID = carID;
- }
-
- public long getCarID() {
- return carID;
- }
-
- public void setCarID(long carID) {
- this.carID = carID;
- }
-
-}
diff --git a/Common/src/Messages/SoftwareInstallRequest.java b/Common/src/Messages/SoftwareInstallRequest.java
deleted file mode 100644
index 9f1d10a..0000000
--- a/Common/src/Messages/SoftwareInstallRequest.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Provider;
-
-public class SoftwareInstallRequest extends SoftwareMessage {
- private String vehicleManifest;
-
- public SoftwareInstallRequest(String softwareID, Provider provider, String vehicleManifest) {
- super(softwareID,provider);
- this.vehicleManifest=vehicleManifest;
- }
-
- public String getVehicleManifest() {
- return vehicleManifest;
- }
-
- public void setVehicleManifest(String vehicleManifest) {
- this.vehicleManifest = vehicleManifest;
- }
-}
diff --git a/Common/src/Messages/SoftwareInstallationPackage.java b/Common/src/Messages/SoftwareInstallationPackage.java
deleted file mode 100644
index 7320439..0000000
--- a/Common/src/Messages/SoftwareInstallationPackage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Provider;
-import EnvironmentObjects.Software.Software;
-
-public class SoftwareInstallationPackage extends SoftwareMessage {
- private Software software;
- private String updatedManifest;
-
- public SoftwareInstallationPackage(String softwareID, Software software, Provider provider, String updatedManifest){
- super(softwareID, provider);
- this.software=software;
- this.updatedManifest=updatedManifest;
- }
-
- public Software getSoftware() {
- return software;
- }
-
- public void setSoftware(Software software) {
- this.software = software;
- }
-
- public String getUpdatedManifest() {
- return updatedManifest;
- }
-
- public void setUpdatedManifest(String updatedManifest) {
- this.updatedManifest = updatedManifest;
- }
-}
diff --git a/Common/src/Messages/SoftwareMessage.java b/Common/src/Messages/SoftwareMessage.java
deleted file mode 100644
index a9558ae..0000000
--- a/Common/src/Messages/SoftwareMessage.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Provider;
-
-public class SoftwareMessage extends Message {
- private String softwareID;
- private Provider provider;
-
- public SoftwareMessage(String softwareID,Provider provider) {
- this.softwareID = softwareID;
- this.provider=provider;
- }
-
- public String getSoftwareID() {
- return softwareID;
- }
-
- public void setSoftwareID(String softwareID) {
- this.softwareID = softwareID;
- }
-
- public Provider getProvider() {
- return provider;
- }
-
- public void setProvider(Provider provider) {
- this.provider = provider;
- }
-}
diff --git a/Common/src/Messages/SoftwareRegistrationMessage.java b/Common/src/Messages/SoftwareRegistrationMessage.java
deleted file mode 100644
index 1fbe4fc..0000000
--- a/Common/src/Messages/SoftwareRegistrationMessage.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package Messages;
-
-import EnvironmentObjects.Description;
-import EnvironmentObjects.Provider;
-
-/**
- * @author Linus Hestermeyer
- *
- */
-public class SoftwareRegistrationMessage extends SoftwareMessage {
- private Description description;
- private long inquiryID;
-
- public SoftwareRegistrationMessage(Description description, long inquiryID, String swID, Provider provider) {
- super(swID,provider);
- this.description = description;
- this.inquiryID = inquiryID;
- }
-
- public Description getDescription() {
- return description;
- }
-
- public void setDescription(Description description) {
- this.description = description;
- }
-
- public long getInquiryID() {
- return inquiryID;
- }
-
- public void setInquiryID(long inquiryID) {
- this.inquiryID = inquiryID;
- }
-}
diff --git a/Common/src/Messages/SoftwareSearchRequest.java b/Common/src/Messages/SoftwareSearchRequest.java
deleted file mode 100644
index c5e2671..0000000
--- a/Common/src/Messages/SoftwareSearchRequest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package Messages;
-
-/**
- *
- */
-public class SoftwareSearchRequest extends Message{
- /**
- * Empty Request means, that the Driver wants to be proposed to any possible Software Fit
- */
- public SoftwareSearchRequest() {
- }
-
- /*
- todo:
- Konstruktoren mit Kennzahlen etc. drin
- public SoftwareSearchRequest() {
-
- }
- */
-
-
-}
diff --git a/Installationsordner/CarControlUnit.jar b/Installationsordner/CarControlUnit.jar
new file mode 100644
index 0000000..39d0fe3
Binary files /dev/null and b/Installationsordner/CarControlUnit.jar differ
diff --git a/Installationsordner/CarlaScriptThesis/simulation_handler_automatic.py b/Installationsordner/CarlaScriptThesis/simulation_handler_automatic.py
new file mode 100644
index 0000000..10f1c6e
--- /dev/null
+++ b/Installationsordner/CarlaScriptThesis/simulation_handler_automatic.py
@@ -0,0 +1,174 @@
+import glob
+import os
+import sys
+import time
+import json
+import socket
+
+try:
+ sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
+ sys.version_info.major,
+ sys.version_info.minor,
+ 'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
+except IndexError:
+ pass
+
+import carla
+
+import argparse
+import logging
+import random
+import _thread
+
+def main():
+ state=0
+ print("")
+ print("Verbindung mit Carla wird hergestellt...")
+ actor_list = []
+ try:
+ client = carla.Client('localhost', 2000)
+ client.set_timeout(10.0)
+
+
+ world = client.get_world()
+
+ # Create a TCP/IP socket
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+
+ # Bind the socket to the port
+ server_address = ('192.168.178.145', 22898)
+
+ msg=b''
+ sock.connect(server_address)
+ print('succesfull')
+ encoding = 'utf-8'
+
+ #gameloop
+ while(state<7):
+ while True:
+ time.sleep(5) # wait 5 secs.
+ data = sock.recv(512)
+
+ #parse received Message
+ byte_list = list(data)
+ result = "".join(map(chr, byte_list))
+ print(result)
+
+ try:
+ noObj, obj = result.split('{')
+ obj = "{"+obj
+
+ #parse to json
+ msg = json.loads(obj)
+
+ #get certain attribute
+ state=msg['action']
+ print(state)
+ if(state<8 and state >-1):
+ break
+ except:
+ pass
+
+ print("")
+
+ if(state ==0):
+ print("Verbindung erfolgreich")
+
+ elif(state ==1):
+ # spawnen
+ vehicle1 = spawnCar(world, 8)
+ actor_list.append(vehicle1)
+ print(vehicle1)
+
+ elif(state ==2):
+ #los fahren
+ drivToParkingArea(vehicle1)
+
+ elif(state ==3):
+ #in Registrationzone fahren
+ for actor in actor_list:
+ actor.destroy()
+ actor_list.remove(actor)
+ vehicle1 = spawnCar(world, 10)
+ actor_list.append(vehicle1)
+ driveIntoPerception(vehicle1)
+
+ elif(state==4):
+ #Parken
+ driveToParkinglot(vehicle1)
+
+ elif(state==5):
+ # weg fahren
+ driveAway(vehicle1)
+
+ elif(state==6):
+ # alle löschen
+ for actor in actor_list:
+ actor.destroy()
+ actor_list.remove(actor)
+
+ print("")
+
+ finally:
+ print('Simulation is vorbei! Vielen Dank für Ihr Interesse!')
+ print('Räume die Simulation auf....')
+ for actor in actor_list:
+ actor.destroy()
+ print('Fertig.')
+
+
+def drivToParkingArea(vehicle1):
+ print('Fahre zum Parkplatz')
+ vehicle1.apply_control(carla.VehicleControl(throttle=0.7, steer=0.0))
+ time.sleep(6.3)
+ vehicle1.apply_control(carla.VehicleControl(throttle=0.0, steer=0.0))
+
+def spawnCar(world, spawnpoint):
+ print('Auto spawnt')
+ blueprint_library = world.get_blueprint_library()
+ bp = blueprint_library.filter('model3')[0]
+ sp1 = world.get_map().get_spawn_points()[spawnpoint]
+
+ return world.spawn_actor(bp, sp1)
+
+
+def driveIntoPerception(vehicle1):
+ # drive into perception Area
+ print('Fahre in Registrierungs zone')
+ vehicle1.apply_control(carla.VehicleControl(throttle=0.4, steer=0))
+ time.sleep(4)
+ vehicle1.apply_control(carla.VehicleControl(throttle=0, steer=-1.0))
+ time.sleep(2.4)
+ vehicle1.apply_control(carla.VehicleControl(throttle=0.0, steer=0.0))
+
+
+def driveToParkinglot(vehicle1):
+ # drive to parkinglot
+ print('Ich Parke!')
+ vehicle1.apply_control(carla.VehicleControl(throttle=0.35, steer=0.0))
+ time.sleep(2.5)
+ vehicle1.apply_control(carla.VehicleControl(throttle=0.15, steer=-0.87))
+ time.sleep(3.2)
+ #vehicle1.apply_control(carla.VehicleControl(throttle=0.15, steer=0.0))
+ #time.sleep(2)
+ vehicle1.apply_control(carla.VehicleControl(throttle=0.0, steer=0.0))
+
+
+
+def driveAway(vehicle1):
+ print('Ich fahre weg!')
+ vehicle1.apply_control(carla.VehicleControl(reverse=1, throttle=-0.3, steer=0.75))
+ time.sleep(5.4)
+ vehicle1.apply_control(carla.VehicleControl(reverse=0, throttle=0.5, steer=0.0))
+ time.sleep(6)
+ vehicle1.apply_control(carla.VehicleControl(throttle=0.0, steer=0.0))
+
+
+if __name__ == '__main__':
+
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+ finally:
+ print('\ndone.')
diff --git a/Installationsordner/Server.jar b/Installationsordner/Server.jar
new file mode 100644
index 0000000..7b71549
Binary files /dev/null and b/Installationsordner/Server.jar differ
diff --git a/OEMVerificationServer/OEMVerificationServer.iml b/OEMVerificationServer/OEMVerificationServer.iml
deleted file mode 100644
index bc7f872..0000000
--- a/OEMVerificationServer/OEMVerificationServer.iml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OEMVerificationServer/Server.iml b/OEMVerificationServer/Server.iml
deleted file mode 100644
index 35ffb46..0000000
--- a/OEMVerificationServer/Server.iml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OEMVerificationServer/pom.xml b/OEMVerificationServer/pom.xml
deleted file mode 100644
index 617b186..0000000
--- a/OEMVerificationServer/pom.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
- 4.0.0
-
-
- linushestermeyer
- Common
- 1.0-SNAPSHOT
- compile
-
-
-
-
- linushestermeyer
- bachelorthesis-java
- 1.0-SNAPSHOT
-
-
- linushestermeyer
- Server
- 1.0-SNAPSHOT
-
-
-
-
\ No newline at end of file
diff --git a/OEMVerificationServer/src/META-INF/MANIFEST.MF b/OEMVerificationServer/src/META-INF/MANIFEST.MF
deleted file mode 100644
index 352b7f2..0000000
--- a/OEMVerificationServer/src/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: ServerMain
-
diff --git a/OEMVerificationServer/src/ServerMain.java b/OEMVerificationServer/src/ServerMain.java
deleted file mode 100644
index d764566..0000000
--- a/OEMVerificationServer/src/ServerMain.java
+++ /dev/null
@@ -1,7 +0,0 @@
-import director_repository.Director;
-
-public class ServerMain {
- public static void main(String[] args) {
- Director director = new Director();
- }
-}
diff --git a/OEMVerificationServer/src/director_repository/Director.java b/OEMVerificationServer/src/director_repository/Director.java
deleted file mode 100644
index 5d3cb0d..0000000
--- a/OEMVerificationServer/src/director_repository/Director.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package director_repository;
-
-import EnvironmentObjects.Software.Software;
-import Messages.*;
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
-import network.NettyServer;
-import repos.ImageRepository;
-
-/**
- * Listens on messages regarding a service handles the content.
- * @author linus hestermeyer
- */
-public class Director {
- private EventBus eventBus;
- private ImageRepository database;
-
- public Director() {
- this.eventBus = new EventBus();
- eventBus.register(this);
- NettyServer nettyServer = new NettyServer(eventBus);
- }
-
-
- /**
- * This method is needed for filling getting all the information needed for a software.
- * @param softwareContentRequest
- */
- @Subscribe
- public void incomingContentRequest (SoftwareContentRequest softwareContentRequest){
- System.err.println("Anfrage für Softwarebeschreibung erhalten, InquiryID: "+ softwareContentRequest.getInquiryID()
- + "\n Service Provider: "+ softwareContentRequest.getProvider().getProviderName()
- );
- System.err.println("");
- SUPR.determineIfSoftwareIsNeeded();
- System.err.println("");
- if(exists(softwareContentRequest.getSoftwareID())){
- Software sw = ImageRepository.getInstance().getSoftwareByKey(softwareContentRequest.getSoftwareID());
-
- SoftwareContentMessage msg = new SoftwareContentMessage(
- sw.getDescription(),
- true,
- softwareContentRequest.getInquiryID(),
- sw.getProvider(),
- sw.getSoftwareID(),
- sw.getVerifiedServiceProviders()
- );
- System.err.println("Beschreibung wurde erstellt.");
- System.err.println("Beschreibung wird verschickt!");
- softwareContentRequest.getCtx().writeAndFlush(msg);
- }
-
- }
-
- @Subscribe
- public void handleSWInstallRequest(SoftwareInstallRequest softwareInstallRequest){
- System.err.println("Installationsanfrage für Software erhalten."
- + "\n Software_ID: "+ softwareInstallRequest.getSoftwareID()
- );
-
- String manifest ="";
- try{
- manifest =InventoryDatabase.getInstance().getManifestByKey(InventoryDatabase.CAR_1_ID);
-
- System.err.println("Vom Fahrzeug geschicktes Manifest: \n"+softwareInstallRequest.getVehicleManifest());
- System.err.println("Auf Server gespeichertes Manifest: \n"+manifest);
- System.err.println("");
- // Verification as described here: https://uptane.github.io/papers/uptane-standard.1.0.1.html#directing-installation-of-images-on-vehicles
- if(!manifest.equals(softwareInstallRequest.getVehicleManifest())){
- prepareSoftware(softwareInstallRequest, false);
- }else{
- prepareSoftware(softwareInstallRequest, true);
- }
- }catch (Exception e){
- e.printStackTrace();
- }
- }
-
- private void prepareSoftware(SoftwareInstallRequest softwareInstallRequest, boolean verified) {
- if(verified) {
- System.err.println("Fahrzeugsicherheit garantiert!");
- try {
- //Load the required Software from Database
- Software required = ImageRepository.getInstance().getSoftwareByKey(softwareInstallRequest.getSoftwareID());
-
- String manifest = softwareInstallRequest.getVehicleManifest();
- manifest += manifest + " " + required.getSoftwareID() + ": " + required.getVersion() + "\r\n";
-
- SoftwareInstallationPackage pkg = new SoftwareInstallationPackage(required.getSoftwareID(), required, required.getProvider(), manifest);
- softwareInstallRequest.getCtx().writeAndFlush(pkg);
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else{
- try{
- Software required = ImageRepository.getInstance().getSoftwareByKey(softwareInstallRequest.getSoftwareID());
-
- System.err.println("Fahrzeugsicherheit nicht garantiert!");
- SoftwareInstallationPackage pkg = new SoftwareInstallationPackage(required.getSoftwareID(), null, null, softwareInstallRequest.getVehicleManifest());
- softwareInstallRequest.getCtx().writeAndFlush(pkg);
- }catch (Exception e){
- e.printStackTrace();
- }
- }
- }
-
- @Subscribe
- public void handleSWSearchRequest(SoftwareSearchRequest request){
- /*
- Todo.
- SUPR.findBestSoftware(request)
- */
- }
-
- private boolean exists(String requiredSWID) {
- Software sw = ImageRepository.getInstance().getSoftwareByKey(requiredSWID);
- if(sw != null)
- return true;
- return false;
- }
-
-}
diff --git a/OEMVerificationServer/src/director_repository/InventoryDatabase.java b/OEMVerificationServer/src/director_repository/InventoryDatabase.java
deleted file mode 100644
index 0c22ba4..0000000
--- a/OEMVerificationServer/src/director_repository/InventoryDatabase.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package director_repository;
-
-import java.util.HashMap;
-
-public class InventoryDatabase {
-
- public static final String CAR_1_ID = "CAR-LA-1";
- public static final String CAR_1_MANIFEST =
- "Software:\r\n" +
- " DriveAutomaticBasic: 1.0\r\n" +
- " DriveInMcDonalds: 1.2\r\n";
- private HashMap manifests;
- private static InventoryDatabase database;
-
- public InventoryDatabase() {
- this.manifests = new HashMap<>();
- manifests.put(CAR_1_ID, CAR_1_MANIFEST);
- }
-
- public static InventoryDatabase getInstance(){
- if(database == null){
- database = new InventoryDatabase();
- }
- return database;
- }
-
- public String getManifestByKey(String carID){
- return manifests.get(carID);
- }
-}
diff --git a/OEMVerificationServer/src/director_repository/SUPR.java b/OEMVerificationServer/src/director_repository/SUPR.java
deleted file mode 100644
index e171c8f..0000000
--- a/OEMVerificationServer/src/director_repository/SUPR.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package director_repository;
-
-import EnvironmentObjects.Software.Software;
-import Messages.SoftwareSearchRequest;
-
-import java.util.ArrayList;
-
-public class SUPR {
-
- /*
- Todo: add searchParam and Kennzahlen
- */
- public static ArrayList findBestSoftware(SoftwareSearchRequest request){
- return null;
- }
-
- public static void determineIfSoftwareIsNeeded(){
- System.err.println("------------------------------------- SUPR -------------------------------------");
- System.err.println("Server bestimmt die Mehrwerte der Software für das Fahrzeug.");
- System.err.println("Funktionalität nicht implementiert, soll lediglich den Ablauf verdeutlichen.");
- System.err.println("--------------------------------------------------------------------------------");
- }
-}
diff --git a/OEMVerificationServer/src/network/INettyServer.java b/OEMVerificationServer/src/network/INettyServer.java
deleted file mode 100644
index 0795b11..0000000
--- a/OEMVerificationServer/src/network/INettyServer.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package network;
-
-/**
- * Ein NettyServer Interface, welches eigentlich nicht nötig ist. Zu viel generalisiert.
- *
- * @author Linus Hestermeyer
- */
-public interface INettyServer {
-public void start(int port);
-}
diff --git a/OEMVerificationServer/src/network/NettyServer.java b/OEMVerificationServer/src/network/NettyServer.java
deleted file mode 100644
index adc968d..0000000
--- a/OEMVerificationServer/src/network/NettyServer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package network;
-
-import com.google.common.eventbus.EventBus;
-import io.netty.bootstrap.ServerBootstrap;
-import io.netty.channel.*;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioServerSocketChannel;
-import io.netty.handler.codec.serialization.ClassResolvers;
-import io.netty.handler.codec.serialization.ObjectDecoder;
-import io.netty.handler.codec.serialization.ObjectEncoder;
-import io.netty.handler.logging.LogLevel;
-import io.netty.handler.logging.LoggingHandler;
-
-/**
- * Start der Netty-Kommunikation
- *
- * @author Linus Hestermeyer
- */
-public class NettyServer implements INettyServer{
- private EventBus eventBus;
- private int port;
-
- public NettyServer(EventBus eventBus) {
- this.eventBus = eventBus;
- this.start(NetworkConfig.serverPort);
- }
-
- /**
- * Startet den Server.
- */
- public void start(int port){
- System.out.println("NettyServer is starting...");
- //teile entnommen von: https://netty.io/wiki/user-guide-for-5.x.html
- EventLoopGroup bossGroup = new NioEventLoopGroup(1);
- EventLoopGroup workerGroup = new NioEventLoopGroup();
- try {
- ServerBootstrap serverBootstrap = new ServerBootstrap();
- serverBootstrap.group(bossGroup, workerGroup)
- .channel(NioServerSocketChannel.class)
- .option(ChannelOption.SO_BACKLOG, 100)
- .handler(new LoggingHandler(LogLevel.ERROR))
- .childHandler(new ChannelInitializer() {
- @Override
- public void initChannel(SocketChannel ch) throws Exception {
- ChannelPipeline p = ch.pipeline();
- ch.pipeline().addLast(new ObjectEncoder());
- ch.pipeline().addLast(new ObjectDecoder(9048576 ,ClassResolvers.cacheDisabled(null)));
- ch.pipeline().addLast(new NettyServerHandler(eventBus));
- }
- });
-
- ChannelFuture future = serverBootstrap.bind(port).sync();
- future.channel().closeFuture().sync();
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- finally {
- bossGroup.shutdownGracefully();
- workerGroup.shutdownGracefully();
- }
- }
-
- /**
- * Setzt den Port
- * @param port Port
- */
- public void setPort(int port){
- this.port = port;
- }
-}
diff --git a/OEMVerificationServer/src/network/NettyServerHandler.java b/OEMVerificationServer/src/network/NettyServerHandler.java
deleted file mode 100644
index 344b672..0000000
--- a/OEMVerificationServer/src/network/NettyServerHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package network;
-
-import Messages.IMessage;
-import com.google.common.eventbus.EventBus;
-import io.netty.channel.ChannelHandlerAdapter;
-import io.netty.channel.ChannelHandlerContext;
-
-/**
- * Netty Handler der read and write Operationen durchführt.
- *
- * @author Linus Hestermeyer
- *
- * teile entnommen von: https://netty.io/wiki/user-guide-for-5.x.html
- */
-public class NettyServerHandler extends ChannelHandlerAdapter {
-
- private EventBus eb;
-
- public NettyServerHandler(EventBus eventBus) {
- this.eb = eventBus;
- }
-
- /**
- * Liest den Input aus und postet Messages auf den EventBus
- *
- * @param ctx Channel Context
- * @param msg Was ankommt bei Netty
- *
- */
- @Override
- public void channelRead(ChannelHandlerContext ctx, Object msg) {
- //Alles was kein IMessage ist muss geblockt werden!
- System.err.println("Received: "+msg);
- if(msg instanceof IMessage){
- ((IMessage) msg).setCtx(ctx);
- this.eb.post(msg);
- }
-
- }
-
- @Override
- public void channelReadComplete(ChannelHandlerContext ctx) {
- ctx.flush();
- }
-
- /**
- * Wenn eine Exception in der Verbindung auftritt, wird diese Verbindung geschlossen und
- * postet ein LogoutCommand sodass der User des Clienten aus der chat.Lobby entfernt werden kann.
- *
- * @param ctx Channel Context
- * @param cause Exception
- *
- */
- @Override
- public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
- cause.printStackTrace();
-
- ctx.close();
- }
-}
\ No newline at end of file
diff --git a/OEMVerificationServer/src/network/NetworkConfig.java b/OEMVerificationServer/src/network/NetworkConfig.java
deleted file mode 100644
index 5444f03..0000000
--- a/OEMVerificationServer/src/network/NetworkConfig.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package network;
-
-public class NetworkConfig
-{
- public static final int serverPort = 48120;
-}
diff --git a/OEMVerificationServer/src/repos/ImageRepository.java b/OEMVerificationServer/src/repos/ImageRepository.java
deleted file mode 100644
index 1698730..0000000
--- a/OEMVerificationServer/src/repos/ImageRepository.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package repos;
-
-import EnvironmentObjects.Software.ParkingServiceSoftware;
-import EnvironmentObjects.Software.Software;
-
-import java.util.HashMap;
-
-public class ImageRepository {
- private HashMap softwares;
- private static ImageRepository database;
-
- public ImageRepository() {
- this.softwares = new HashMap<>();
- softwares.put(ParkingServiceSoftware.SOFTWARE_ID, new ParkingServiceSoftware());
- }
-
- public static ImageRepository getInstance(){
- if(database == null){
- database = new ImageRepository();
- }
- return database;
- }
-
- public Software getSoftwareByKey(String swID){
- return softwares.get(swID);
- }
-}
diff --git a/OEMVerificationServer/src/repos/ScenarioRepository.java b/OEMVerificationServer/src/repos/ScenarioRepository.java
deleted file mode 100644
index a9f27f1..0000000
--- a/OEMVerificationServer/src/repos/ScenarioRepository.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package repos;
-
-import java.util.HashMap;
-
-public class ScenarioRepository {
- private HashMap scenarios;
- private static ScenarioRepository database;
-
- public ScenarioRepository() {
- this.scenarios = new HashMap<>();
- //add scenarios
- }
-
- public static ScenarioRepository getInstance(){
- if(database == null){
- database = new ScenarioRepository();
- }
- return database;
- }
-
- public String getScenario(String swID){
- return scenarios.get(swID);
- }
-}
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 7a44030..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
- 4.0.0
-
- linushestermeyer
- bachelorthesis-java
- pom
- 1.0-SNAPSHOT
-
-
- CarControlUnit
- Common
- OEMVerificationServer
-
-
-
- 1.8
- 1.8
-
-
-
- io.netty
- netty-all
- 5.0.0.Alpha2
-
-
- mysql
- mysql-connector-java
- 5.1.46
-
-
- com.airhacks
- afterburner.fx
- 1.7.0
-
-
-
- com.google.inject
- guice
- 4.2.0
-
-
-
- com.google.guava
- guava
- 27.0-jre
-
-
-
-
- org.json
- json
- 20200518
-
-
-
-
\ No newline at end of file