Package org.eclipse.mosaic.app.tutorial
Class WeatherServerApp
java.lang.Object
org.eclipse.mosaic.fed.application.app.AbstractApplication<ServerOperatingSystem>
org.eclipse.mosaic.app.tutorial.WeatherServerApp
- All Implemented Interfaces:
Application
,CommunicationApplication
,OperatingSystemAccess<ServerOperatingSystem>
,EventProcessor
public class WeatherServerApp
extends AbstractApplication<ServerOperatingSystem>
implements CommunicationApplication
This class acts as an omniscient application for a server that warns vehicles
about certain hazards on the road. The hazard is hard-coded for tutorial purposes,
in more realistic scenarios the location would've been updated dynamically.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
onAcknowledgementReceived
(ReceivedAcknowledgement acknowledgement) Receive an acknowledgement from a previously sent V2X Message.void
onCamBuilding
(CamBuilder camBuilder) This method is called when a CAM is build by different Simulation Units that support CAM connectivity.void
onMessageReceived
(ReceivedV2xMessage receivedV2xMessage) Receive a V2X Message.void
onMessageTransmitted
(V2xMessageTransmission v2xMessageTransmission) This method is called when a V2X message is transmitted.void
This method is called by mosaic-application when the simulation has finished.void
This method is called by the Application Simulator when the vehicle that has been equipped with this application enters the simulation.void
processEvent
(Event event) This method is called by mosaic-application when a previously triggered event is handed over to the application for processing.Methods inherited from class org.eclipse.mosaic.fed.application.app.AbstractApplication
canProcessEvent, getLog, getOperatingSystem, getRandom, isTornDown, isValidStateAndLog, setUp, tearDown
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.mosaic.lib.util.scheduling.EventProcessor
canProcessEvent
Methods inherited from interface org.eclipse.mosaic.fed.application.app.api.OperatingSystemAccess
getOs
-
Constructor Details
-
WeatherServerApp
public WeatherServerApp()
-
-
Method Details
-
onStartup
public void onStartup()This method is called by the Application Simulator when the vehicle that has been equipped with this application enters the simulation. It is the first method called of this class during a simulation.- Specified by:
onStartup
in interfaceApplication
-
processEvent
This method is called by mosaic-application when a previously triggered event is handed over to the application for processing. Events can be triggered be this application itself, e.g. to run a routine periodically.- Specified by:
processEvent
in interfaceEventProcessor
- Parameters:
event
- The event to be processed- Throws:
Exception
-
onMessageReceived
Description copied from interface:CommunicationApplication
Receive a V2X Message.- Specified by:
onMessageReceived
in interfaceCommunicationApplication
- Parameters:
receivedV2xMessage
- the received message container.
-
onAcknowledgementReceived
Description copied from interface:CommunicationApplication
Receive an acknowledgement from a previously sent V2X Message.- Specified by:
onAcknowledgementReceived
in interfaceCommunicationApplication
- Parameters:
acknowledgement
- the acknowledgement object which contains the sent V2X Message and the acknowledgement status.
-
onCamBuilding
Description copied from interface:CommunicationApplication
This method is called when a CAM is build by different Simulation Units that support CAM connectivity.- Specified by:
onCamBuilding
in interfaceCommunicationApplication
- Parameters:
camBuilder
- the builder for the CAM
-
onMessageTransmitted
Description copied from interface:CommunicationApplication
This method is called when a V2X message is transmitted.- Specified by:
onMessageTransmitted
in interfaceCommunicationApplication
- Parameters:
v2xMessageTransmission
- the container for the V2XMessage to be transmitted
-
onShutdown
public void onShutdown()This method is called by mosaic-application when the simulation has finished.- Specified by:
onShutdown
in interfaceApplication
-