Package de.hpi.eworld.visualizer.simulation.traci.common

Examples of de.hpi.eworld.visualizer.simulation.traci.common.Message.writeToStream()


   */
  public void subscribeToSimulationValues() throws Exception {
    SubscribeSimulationValueRetrivalCommandGenerator simulationValue = new SubscribeSimulationValueRetrivalCommandGenerator(
        ModelManager.getInstance().getSimulationStartTime() * 1000, ModelManager.getInstance().getSimulationEndTime() * 1000);
    Message message = new Message(simulationValue);
    message.writeToStream(this.outputStream);
    Message response = Message.readFromStream(this.inputStream);
    for (Command command:response.getCommands()) {
      switch(command.getId()) {
        case SubscribeSimulationValueRetrivalCommandGenerator.ID:
          ResponseCommandReader responseCommand = ResponseCommandReader.fromCommand(command);
View Full Code Here


   */
  private float[] subscribeToVehicleValues(String id, int startTime) throws IOException, TraciException {
    SubscribeVehicleValueRetrivalCommandGenerator vehicleValue = new SubscribeVehicleValueRetrivalCommandGenerator(
        startTime, ModelManager.getInstance().getSimulationEndTime() * 1000, id);
    Message request = new Message(vehicleValue);
    request.writeToStream(this.outputStream);
    Message response = Message.readFromStream(this.inputStream);
    float[] position = null;
    for (Command command:response.getCommands()) {
      switch(command.getId()) {
        case SubscribeVehicleValueRetrivalCommandGenerator.ID:
View Full Code Here

    // 1 time step = 1000 steps in sumo
    if(!readOnly) {
      this.time = time;
      SimulationStepCommandGenerator2 simulationStep = new SimulationStepCommandGenerator2(time * 1000);
      Message message = new Message(simulationStep);
      message.writeToStream(this.outputStream);
    }
   
    Map<String, double[]> added = new HashMap<String, double[]>();
    Map<String, double[]> updated = new HashMap<String, double[]>();
    List<String> removed = new ArrayList<String>();
View Full Code Here

   *             Communication Error.
   */
  public void closeConnection() throws IOException {
   
    Message message = new Message(new CloseCommandGenerator());
    message.writeToStream(this.outputStream);
   
    while(true) {
      message = Message.readFromStream(this.inputStream);
      for(Command command : message.getCommands()) {
        if(command.getId() ==  CloseCommandGenerator.ID) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.