public abstract class AbstractTransceiver
extends nl.tudelft.simulation.event.EventProducer
implements org.opentrafficsim.imb.transceiver.EventTransceiver
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Constructor and Description |
---|
AbstractTransceiver(String id,
org.opentrafficsim.imb.connector.Connector connector,
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator)
Construct a new AbstractTranceiver.
|
Modifier and Type | Method and Description |
---|---|
void |
addIMBtoOTSChannel(String imbEventName,
nl.tudelft.simulation.event.EventType eventType,
IMBToOTSTransformer imbToOTSTransformer)
Register a new channel for sending an IMB message to an OTS EventListener.
|
void |
addIMBtoOTSChannel(String imbEventName,
org.opentrafficsim.imb.transceiver.IMBMessageHandler imbMessageHandler)
Register that we are interested in an IMB payload, but do not register a listener or transformer.
|
void |
addOTSToIMBChannel(nl.tudelft.simulation.event.EventProducerInterface producer,
nl.tudelft.simulation.event.EventType eventType,
String imbEventName,
Object[] imbNewPayload,
OTSToIMBTransformer transformer)
Make a connection from OTS to IMB, and and send a NEW message to IMB for the imbEventName with a corresponding payload.
|
org.opentrafficsim.imb.connector.Connector |
getConnector() |
String |
getId() |
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface |
getSimulator()
Retrieve the simulator.
|
void |
handleMessageFromIMB(String imbEventName,
nl.tno.imb.TByteBuffer imbPayload) |
void |
notify(nl.tudelft.simulation.event.EventInterface event) |
void |
removeOTSToIMBChannel(nl.tudelft.simulation.event.EventProducerInterface producer,
nl.tudelft.simulation.event.EventType eventType,
Object[] imbDeletePayload)
Remove a connection from OTS to IMB, and and send a DELETE message to IMB for the imbEventName with a corresponding
payload.
|
String |
toString() |
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
public AbstractTransceiver(String id, org.opentrafficsim.imb.connector.Connector connector, org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator)
id
- String; an id to identify the channel, e.g., "GTU" or "Simulator Control"connector
- Connector; the IMB connector through which this transceiver communicatessimulator
- OTSDEVSSimulatorInterface; the simulator to schedule the incoming notifications onNullPointerException
- in case one of the arguments is null.public final void addOTSToIMBChannel(nl.tudelft.simulation.event.EventProducerInterface producer, nl.tudelft.simulation.event.EventType eventType, String imbEventName, Object[] imbNewPayload, OTSToIMBTransformer transformer) throws org.opentrafficsim.imb.IMBException
producer
- EventProducerInterface; the OTS event producer that notifies this Transceiver about state changeseventType
- EventType; the event type that corresponds to the state change for this channelimbEventName
- String; the IMB event name for the message to sendimbNewPayload
- Object[]; the information to send to IMB with the IMB NEW messagetransformer
- OTSToIMBTransformer; the transformer to use for create the IMB CHANGE events from an OTS Event contentNullPointerException
- in case one of the arguments is null.org.opentrafficsim.imb.IMBException
- in case the mapping from an EventType to an IMB event name is different from a previous time when a
mapping was registered for the same EventType (but for a different OTS EventProducer instance), when the
transformer for an EventType was changed a previous time when a mapping was registered, or when the
subscription to the OTS EventProducer fails.public final void removeOTSToIMBChannel(nl.tudelft.simulation.event.EventProducerInterface producer, nl.tudelft.simulation.event.EventType eventType, Object[] imbDeletePayload) throws org.opentrafficsim.imb.IMBException
producer
- EventProducerInterface; the OTS event producer to which we should stop listeningeventType
- EventType; the event type that corresponds for this channelimbDeletePayload
- Object[]; the information to send to IMB with the IMB DELETE messageNullPointerException
- in case one of the arguments is null.org.opentrafficsim.imb.IMBException
- when the cancellation of the subscription to the OTS EventProducer fails, or when the EventType for
the channel was not registered with an addOTSToIMBChannel call.public void notify(nl.tudelft.simulation.event.EventInterface event) throws RemoteException
notify
in interface nl.tudelft.simulation.event.EventListenerInterface
RemoteException
public void addIMBtoOTSChannel(String imbEventName, nl.tudelft.simulation.event.EventType eventType, IMBToOTSTransformer imbToOTSTransformer) throws org.opentrafficsim.imb.IMBException
imbEventName
- String; the name of the IMB eventeventType
- EventType; 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 payloadorg.opentrafficsim.imb.IMBException
- in case the registration failspublic void addIMBtoOTSChannel(String imbEventName, org.opentrafficsim.imb.transceiver.IMBMessageHandler imbMessageHandler) throws org.opentrafficsim.imb.IMBException
imbEventName
- String; the name of the IMB eventimbMessageHandler
- IMBMessageHandler the message handler that takes care of the IMB messageorg.opentrafficsim.imb.IMBException
- in case registration failspublic void handleMessageFromIMB(String imbEventName, nl.tno.imb.TByteBuffer imbPayload) throws org.opentrafficsim.imb.IMBException
handleMessageFromIMB
in interface org.opentrafficsim.imb.transceiver.Transceiver
org.opentrafficsim.imb.IMBException
public String getId()
getId
in interface org.opentrafficsim.imb.transceiver.Transceiver
public final org.opentrafficsim.imb.connector.Connector getConnector()
getConnector
in interface org.opentrafficsim.imb.transceiver.Transceiver
public org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface getSimulator()
Copyright © 2014–2016 Delft University of Technology. All rights reserved.