Class UserTaggedValueReadingApp
- java.lang.Object
-
- org.eclipse.mosaic.fed.application.app.AbstractApplication<VehicleOperatingSystem>
-
- org.eclipse.mosaic.app.tutorial.cam.UserTaggedValueReadingApp
-
- All Implemented Interfaces:
Application
,CommunicationApplication
,OperatingSystemAccess<VehicleOperatingSystem>
,VehicleApplication
,EventProcessor
public class UserTaggedValueReadingApp extends AbstractApplication<VehicleOperatingSystem> implements VehicleApplication, CommunicationApplication
This is a simple application that reads received V2X messages and logs either the user tagged value if the received message was a CAM or the message type and source name if it wasn't a CAM.
-
-
Constructor Summary
Constructors Constructor Description UserTaggedValueReadingApp()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onAcknowledgementReceived(ReceivedAcknowledgement acknowledgedMessage)
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
onShutdown()
The operating system calls this method to notify that the application is going to be torn down.void
onStartup()
We should enable ad hoc module here to be able to receive messages that were sent per ad hocvoid
onVehicleUpdated(VehicleData previousVehicleData, VehicleData updatedVehicleData)
Is called when ever the vehicle has moved.void
processEvent(Event event)
from EventProcessor interface-
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
-
-
-
-
Method Detail
-
onStartup
public void onStartup()
We should enable ad hoc module here to be able to receive messages that were sent per ad hoc- Specified by:
onStartup
in interfaceApplication
-
onMessageReceived
public void onMessageReceived(ReceivedV2xMessage receivedV2xMessage)
Description copied from interface:CommunicationApplication
Receive a V2X Message.- Specified by:
onMessageReceived
in interfaceCommunicationApplication
- Parameters:
receivedV2xMessage
- the received message container.
-
onAcknowledgementReceived
public void onAcknowledgementReceived(ReceivedAcknowledgement acknowledgedMessage)
Description copied from interface:CommunicationApplication
Receive an acknowledgement from a previously sent V2X Message.- Specified by:
onAcknowledgementReceived
in interfaceCommunicationApplication
- Parameters:
acknowledgedMessage
- the acknowledgement object which contains the sent V2X Message and the acknowledgement status.
-
onCamBuilding
public void onCamBuilding(CamBuilder camBuilder)
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
public void onMessageTransmitted(V2xMessageTransmission v2xMessageTransmission)
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()
Description copied from interface:Application
The operating system calls this method to notify that the application is going to be torn down.- Specified by:
onShutdown
in interfaceApplication
-
processEvent
public void processEvent(Event event) throws Exception
from EventProcessor interface- Specified by:
processEvent
in interfaceEventProcessor
- Parameters:
event
- the event to process- Throws:
Exception
-
onVehicleUpdated
public void onVehicleUpdated(@Nullable VehicleData previousVehicleData, @Nonnull VehicleData updatedVehicleData)
Description copied from interface:VehicleApplication
Is called when ever the vehicle has moved. That is, if theVehicleData
of the unit has been updated.- Specified by:
onVehicleUpdated
in interfaceVehicleApplication
- Parameters:
previousVehicleData
- the previous state of the vehicleupdatedVehicleData
- the updated state of the vehicle
-
-