Package org.opentrafficsim.remotecontrol
Class Sim0MQControlledOTS
- java.lang.Object
-
- org.opentrafficsim.remotecontrol.Sim0MQControlledOTS
-
- All Implemented Interfaces:
Serializable,EventListener,EventListenerInterface
public class Sim0MQControlledOTS extends Object implements EventListenerInterface
Sim0MQ controlled OTSCopyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version Apr 18, 2017
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSim0MQControlledOTS.OptionsThe command line options.
-
Constructor Summary
Constructors Constructor Description Sim0MQControlledOTS(org.zeromq.ZContext zContext, int port)Construct a new Sim0MQ controlled OTS.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommandLoop()Read commands from the master, execute them and report the results.static voidmain(String[] args)Program entry point.voidnotify(EventInterface event)voidsendToMaster(byte[] data)Safe - synchronized - portal to send a message to the remote controller.
-
-
-
Method Detail
-
main
public static void main(String[] args) throws NetworkException, OTSGeometryException, NamingException, ValueRuntimeException, ParameterException, SimRuntimeException, Sim0MQException, SerializationException, IOException
Program entry point.- Parameters:
args- String[]; the command line arguments- Throws:
OTSGeometryException- on errorNetworkException- on errorNamingException- on errorValueRuntimeException- on errorSimRuntimeException- on errorParameterException- on errorSerializationException- on errorSim0MQException- on errorIOException- on error
-
commandLoop
public void commandLoop()
Read commands from the master, execute them and report the results.
-
sendToMaster
public void sendToMaster(byte[] data)
Safe - synchronized - portal to send a message to the remote controller.- Parameters:
data- byte[]; the data to send
-
notify
public void notify(EventInterface event) throws RemoteException
- Specified by:
notifyin interfaceEventListenerInterface- Throws:
RemoteException
-
-