Class PubSubIMBMessageHandler
- java.lang.Object
-
- org.opentrafficsim.imb.transceiver.PubSubIMBMessageHandler
-
- All Implemented Interfaces:
java.io.Serializable,org.opentrafficsim.imb.transceiver.IMBMessageHandler
public class PubSubIMBMessageHandler extends java.lang.Object implements org.opentrafficsim.imb.transceiver.IMBMessageHandlerThe PubSubIMBMessageHandler handles the IMB message by transforming it into a DSOL Event and sending it to an EventListener at the current simulation time through a simulation event. The EventListener is identified by the OTSToIMBTransformer and stored in an IMBTransformResult after parsing the IMB message.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Sep 11, 2016
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PubSubIMBMessageHandler(java.lang.String imbEventName, TimedEventType eventType, IMBToOTSTransformer imbToOTSTransformer, DEVSSimulatorInterface.TimeDoubleUnit simulator)Construct a new PubSubIMBMessageHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetIMBEventName()voidhandle(nl.tno.imb.TByteBuffer imbPayload)Handle the event by notifying the EventListener that was identified by the imbPayload through the imbToOTSTransformer.
-
-
-
Constructor Detail
-
PubSubIMBMessageHandler
public PubSubIMBMessageHandler(java.lang.String imbEventName, TimedEventType eventType, IMBToOTSTransformer imbToOTSTransformer, DEVSSimulatorInterface.TimeDoubleUnit simulator) throws org.opentrafficsim.imb.IMBExceptionConstruct a new PubSubIMBMessageHandler. The PubSubIMBMessageHandler handles the IMB message by transforming it into a DSOL Event and sending it to the EventListener at the current simulation time through a simulation event.- Parameters:
imbEventName- String; the name of the IMB eventeventType- TimedEventType; the event type that the listener subscribes toimbToOTSTransformer- IMBToOTSTransformer; the transformer that creates the event content and identifies the exact listener on the basis of the IBM event payload, e.g., on the basis of an id within the payloadsimulator- DEVSSimulatorInterface.TimeDoubleUnit; The simulator to schedule the incoming notifications on- Throws:
org.opentrafficsim.imb.IMBException- in case the construction fails
-
-
Method Detail
-
handle
public void handle(nl.tno.imb.TByteBuffer imbPayload) throws org.opentrafficsim.imb.IMBExceptionHandle the event by notifying the EventListener that was identified by the imbPayload through the imbToOTSTransformer. The notification is scheduled on the simulator to make sure that the separate thread that receives events from IMB does not interfere with the execution of the OTS simulation.- Specified by:
handlein interfaceorg.opentrafficsim.imb.transceiver.IMBMessageHandler- Parameters:
imbPayload- TByteBuffer; the IMB payload- Throws:
org.opentrafficsim.imb.IMBException- in case the message cannot be handled
-
getIMBEventName
public final java.lang.String getIMBEventName()
- Specified by:
getIMBEventNamein interfaceorg.opentrafficsim.imb.transceiver.IMBMessageHandler
-
-