public abstract class AbstractTransceiver extends EventProducer implements Transceiver
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.
listenersFIRST_POSITION, LAST_POSITION| Constructor and Description |
|---|
AbstractTransceiver(String id,
Connector connector,
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator)
Construct a new AbstractTranceiver.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addIMBtoOTSChannel(String imbEventName,
EventType eventType,
IMBToOTSTransformer imbToOTSTransformer)
Register a new channel for sending an IMB message to an OTS EventListener.
|
void |
addIMBtoOTSChannel(String imbEventName,
IMBMessageHandler imbMessageHandler)
Register that we are interested in an IMB payload, but do not register a listener or transformer.
|
void |
addOTSToIMBChannel(EventProducerInterface producer,
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.
|
Connector |
getConnector()
Retrieve the IMB connector.
|
String |
getId()
Retrieve the id for the Transceiver channel, e.g.
|
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface |
getSimulator()
Retrieve the simulator.
|
void |
handleMessageFromIMB(String imbEventName,
TByteBuffer imbPayload)
Handle an IMB message sent to OTS.
|
void |
notify(EventInterface event) |
void |
removeOTSToIMBChannel(EventProducerInterface producer,
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, removeListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddListener, addListener, addListener, addListener, removeListenerpublic AbstractTransceiver(String id, 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(EventProducerInterface producer, EventType eventType, String imbEventName, Object[] imbNewPayload, OTSToIMBTransformer transformer) throws 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.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(EventProducerInterface producer, EventType eventType, Object[] imbDeletePayload) throws 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.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(EventInterface event) throws RemoteException
notify in interface EventListenerInterfaceRemoteExceptionpublic void addIMBtoOTSChannel(String imbEventName, EventType eventType, IMBToOTSTransformer imbToOTSTransformer) throws 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 payloadIMBException - in case the registration failspublic void addIMBtoOTSChannel(String imbEventName, IMBMessageHandler imbMessageHandler) throws IMBException
imbEventName - String; the name of the IMB eventimbMessageHandler - IMBMessageHandler the message handler that takes care of the IMB messageIMBException - in case registration failspublic void handleMessageFromIMB(String imbEventName, TByteBuffer imbPayload) throws IMBException
handleMessageFromIMB in interface TransceiverimbEventName - String; the IMB event name of the message that was received from IMBimbPayload - TByteBuffer; the packed IMB message payloadIMBException - in case the IMB event cannot be handled by this Transceiverpublic String getId()
getId in interface Transceiverpublic final Connector getConnector()
getConnector in interface Transceiverpublic org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface getSimulator()
Copyright © 2014–2016 Delft University of Technology. All rights reserved.