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 TypeMethodDescriptionvoidonAcknowledgementReceived(ReceivedAcknowledgement acknowledgement) Receive an acknowledgement from a previously sent V2X Message.voidonCamBuilding(CamBuilder camBuilder) This method is called when a CAM is build by different Simulation Units that support CAM connectivity.voidonMessageReceived(ReceivedV2xMessage receivedV2xMessage) Receive a V2X Message.voidonMessageTransmitted(V2xMessageTransmission v2xMessageTransmission) This method is called when a V2X message is transmitted.voidThis method is called by mosaic-application when the simulation has finished.voidThis method is called by the Application Simulator when the vehicle that has been equipped with this application enters the simulation.voidprocessEvent(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, tearDownMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.mosaic.lib.util.scheduling.EventProcessor
canProcessEventMethods 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:
onStartupin 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:
processEventin interfaceEventProcessor- Parameters:
event- The event to be processed- Throws:
Exception
-
onMessageReceived
Description copied from interface:CommunicationApplicationReceive a V2X Message.- Specified by:
onMessageReceivedin interfaceCommunicationApplication- Parameters:
receivedV2xMessage- the received message container.
-
onAcknowledgementReceived
Description copied from interface:CommunicationApplicationReceive an acknowledgement from a previously sent V2X Message.- Specified by:
onAcknowledgementReceivedin interfaceCommunicationApplication- Parameters:
acknowledgement- the acknowledgement object which contains the sent V2X Message and the acknowledgement status.
-
onCamBuilding
Description copied from interface:CommunicationApplicationThis method is called when a CAM is build by different Simulation Units that support CAM connectivity.- Specified by:
onCamBuildingin interfaceCommunicationApplication- Parameters:
camBuilder- the builder for the CAM
-
onMessageTransmitted
Description copied from interface:CommunicationApplicationThis method is called when a V2X message is transmitted.- Specified by:
onMessageTransmittedin 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:
onShutdownin interfaceApplication
-