@GET
  @Path("/timefactor")
  @Produces({MediaType.TEXT_PLAIN})
  public String getSimulationSpeed() throws IOException {

    GPSdConnection connection = gpsd.getGPSdConnection();
    if (connection == null) {
      return "Not connected to GPS device";
    }

    if (connection instanceof GPSdSimulationConnection) {
      GPSdSimulationConnection simConnection = (GPSdSimulationConnection) connection;
      return "" + simConnection.getTimeFactor();
    }

    return "Not in simulation mode";
  }
  @GET
  @Path("/timefactor/{timefactor}")
  @Produces({MediaType.TEXT_PLAIN})
  public String setSimulationSpeed(@PathParam("timefactor") int timefactor) throws IOException {

    GPSdConnection connection = gpsd.getGPSdConnection();
    if (connection == null) {
      return "Not connected to GPS device";
    }

    if (connection instanceof GPSdSimulationConnection) {
      GPSdSimulationConnection simConnection = (GPSdSimulationConnection) connection;
      simConnection.setTimeFactor(timefactor);
      return "TimeFactor set to: " + timefactor;
    }

    return "Not in simulation mode";
  }