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
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
ConstructorsConstructorDescriptionVehicleSubscribe(Bridge bridge) Creates a newVehicleSubscribeobject.VehicleSubscribe(Bridge bridge, Collection<SumoVar> subscriptionCodes) Creates a newVehicleSubscribeobject.VehicleSubscribe(Bridge bridge, CSumo sumoConfiguration) Creates a newVehicleSubscribeobject. -
Method Summary
Modifier and TypeMethodDescriptionprotected VoidconstructResult(Status status, Object... objects) This method is called during reading the command response when all readers have been executed.voidThis 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 Details
-
VehicleSubscribe
Creates a newVehicleSubscribeobject. Access needs to be public, because command is called using Reflection.- Parameters:
bridge- Connection to Traci.- See Also:
-
VehicleSubscribe
Creates a newVehicleSubscribeobject.- Parameters:
bridge- Connection to Traci.sumoConfiguration- The sumo configuration file.
-
VehicleSubscribe
Creates a newVehicleSubscribeobject. Access needs to be public, because command is called using Reflection.- Parameters:
bridge- Connection to Traci.subscriptionCodes- The parameters for an applicable configuration.
-
-
Method Details
-
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:
executein 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
Description copied from class:AbstractTraciCommandThis 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:
constructResultin 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
-