mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 00:39:58 +00:00
STV: Update API base. Also switch endpoints to mobile.
This commit is contained in:
parent
459dd5743f
commit
04af7037ff
1 changed files with 51 additions and 10 deletions
|
@ -17,16 +17,31 @@
|
||||||
|
|
||||||
package de.schildbach.pte;
|
package de.schildbach.pte;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.schildbach.pte.dto.Line;
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
|
import de.schildbach.pte.dto.Location;
|
||||||
|
import de.schildbach.pte.dto.LocationType;
|
||||||
|
import de.schildbach.pte.dto.NearbyLocationsResult;
|
||||||
import de.schildbach.pte.dto.Product;
|
import de.schildbach.pte.dto.Product;
|
||||||
|
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||||
|
import de.schildbach.pte.dto.QueryTripsContext;
|
||||||
|
import de.schildbach.pte.dto.QueryTripsResult;
|
||||||
|
import de.schildbach.pte.dto.SuggestLocationsResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
*/
|
*/
|
||||||
public class StvProvider extends AbstractEfaProvider {
|
public class StvProvider extends AbstractEfaProvider {
|
||||||
private final static String API_BASE = "http://fahrplan.verbundlinie.at/stv/";
|
private final static String API_BASE = "http://appefa10.verbundlinie.at/android/";
|
||||||
|
|
||||||
public StvProvider() {
|
public StvProvider() {
|
||||||
super(NetworkId.STV, API_BASE);
|
super(NetworkId.STV, API_BASE);
|
||||||
|
@ -35,14 +50,40 @@ public class StvProvider extends AbstractEfaProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Line parseLine(final @Nullable String id, final @Nullable String network, final @Nullable String mot,
|
public NearbyLocationsResult queryNearbyLocations(final EnumSet<LocationType> types, final Location location,
|
||||||
final @Nullable String symbol, final @Nullable String name, final @Nullable String longName,
|
final int maxDistance, final int maxLocations) throws IOException {
|
||||||
final @Nullable String trainType, final @Nullable String trainNum, final @Nullable String trainName) {
|
if (location.hasLocation())
|
||||||
if ("0".equals(mot)) {
|
return mobileCoordRequest(types, location.lat, location.lon, maxDistance, maxLocations);
|
||||||
if ("M".equals(trainType) && trainNum != null)
|
|
||||||
return new Line(id, network, Product.REGIONAL_TRAIN, "M" + trainNum);
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.parseLine(id, network, mot, symbol, name, longName, trainType, trainNum, trainName);
|
if (location.type != LocationType.STATION)
|
||||||
|
throw new IllegalArgumentException("cannot handle: " + location.type);
|
||||||
|
|
||||||
|
throw new IllegalArgumentException("station"); // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryDeparturesResult queryDepartures(final String stationId, final @Nullable Date time,
|
||||||
|
final int maxDepartures, final boolean equivs) throws IOException {
|
||||||
|
checkNotNull(Strings.emptyToNull(stationId));
|
||||||
|
|
||||||
|
return queryDeparturesMobile(stationId, time, maxDepartures, equivs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuggestLocationsResult suggestLocations(final CharSequence constraint) throws IOException {
|
||||||
|
return mobileStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryTripsResult queryTrips(final Location from, final @Nullable Location via, final Location to,
|
||||||
|
final Date date, final boolean dep, final @Nullable Set<Product> products,
|
||||||
|
final @Nullable Optimize optimize, final @Nullable WalkSpeed walkSpeed,
|
||||||
|
final @Nullable Accessibility accessibility, final @Nullable Set<Option> options) throws IOException {
|
||||||
|
return queryTripsMobile(from, via, to, date, dep, products, optimize, walkSpeed, accessibility, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryTripsResult queryMoreTrips(final QueryTripsContext contextObj, final boolean later) throws IOException {
|
||||||
|
return queryMoreTripsMobile(contextObj, later);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue