Class VehicleSubscribe
- java.lang.Object
-
- org.eclipse.mosaic.fed.sumo.bridge.traci.AbstractTraciCommand<Void>
-
- org.eclipse.mosaic.fed.sumo.bridge.traci.VehicleSubscribe
-
- All Implemented Interfaces:
VehicleSubscribe
public class VehicleSubscribe extends AbstractTraciCommand<Void> implements VehicleSubscribe
This class represents the SUMO command which allows to subscribe the vehicle to the application. Several options for vehicle subscription are implemented in this class.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.mosaic.fed.sumo.bridge.traci.AbstractTraciCommand
AbstractTraciCommand.TraciCommandResultReaderBuilder, AbstractTraciCommand.TraciCommandWriterBuilder
-
-
Constructor Summary
Constructors Constructor Description VehicleSubscribe(Bridge bridge)
Creates a newVehicleSubscribe
object.VehicleSubscribe(Bridge bridge, Collection<SumoVar> subscriptionCodes)
Creates a newVehicleSubscribe
object.VehicleSubscribe(Bridge bridge, CSumo sumoConfiguration)
Creates a newVehicleSubscribe
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Void
constructResult(Status status, Object... objects)
This method is called during reading the command response when all readers have been executed.void
execute(Bridge bridge, String vehicleId, long startTime, long endTime)
This method executes the command with the given arguments in order to subscribe the vehicle to the application.-
Methods inherited from class org.eclipse.mosaic.fed.sumo.bridge.traci.AbstractTraciCommand
execute, executeAndReturn, executeAndReturnList, read, write
-
-
-
-
Constructor Detail
-
VehicleSubscribe
public VehicleSubscribe(Bridge bridge)
Creates a newVehicleSubscribe
object. Access needs to be public, because command is called using Reflection.- Parameters:
bridge
- Connection to Traci.- See Also:
- Variable Subscription
-
VehicleSubscribe
public VehicleSubscribe(Bridge bridge, CSumo sumoConfiguration)
Creates a newVehicleSubscribe
object.- Parameters:
bridge
- Connection to Traci.sumoConfiguration
- The sumo configuration file.
-
VehicleSubscribe
public VehicleSubscribe(Bridge bridge, Collection<SumoVar> subscriptionCodes)
Creates a newVehicleSubscribe
object. Access needs to be public, because command is called using Reflection.- Parameters:
bridge
- Connection to Traci.subscriptionCodes
- The parameters for an applicable configuration.
-
-
Method Detail
-
execute
public void execute(Bridge bridge, String vehicleId, long startTime, long endTime) throws CommandException, InternalFederateException
This method executes the command with the given arguments in order to subscribe the vehicle to the application.- Specified by:
execute
in interfaceVehicleSubscribe
- Parameters:
bridge
- Connection to SUMO.vehicleId
- The Id of the Vehicle.startTime
- The time to subscribe the vehicle.endTime
- The end time of the subscription of the vehicle in the application.- Throws:
CommandException
- if the status code of the response is ERROR. The connection to SUMO is still available.InternalFederateException
- if some serious error occurs during writing or reading. The TraCI connection is shut down.
-
constructResult
protected Void constructResult(Status status, Object... objects)
Description copied from class:AbstractTraciCommand
This method is called during reading the command response when all readers have been executed. The results of the readers are passed to this method.- Specified by:
constructResult
in classAbstractTraciCommand<Void>
- Parameters:
status
- the status of the responseobjects
- the objects created by the configured readers- Returns:
- the final result constructed from the passed objects
-
-