mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 00:50:31 +00:00
Fix Sweden departures
This commit is contained in:
parent
7acd4a0afa
commit
1e86a1507e
2 changed files with 25 additions and 4 deletions
|
@ -84,10 +84,12 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
protected final String queryEndpoint;
|
||||
private final int numProductBits;
|
||||
private final String accessId;
|
||||
private String clientType;
|
||||
private Charset jsonGetStopsEncoding;
|
||||
private Charset jsonNearbyStationsEncoding;
|
||||
private final Charset xmlMlcResEncoding;
|
||||
private boolean dominantPlanStopTime = false;
|
||||
private boolean canDoEquivs = true;
|
||||
|
||||
private static class Context implements QueryTripsContext
|
||||
{
|
||||
|
@ -158,21 +160,31 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
this.xmlMlcResEncoding = xmlMlcResEncoding;
|
||||
}
|
||||
|
||||
protected void setClientType(final String clientType)
|
||||
{
|
||||
this.clientType = clientType;
|
||||
}
|
||||
|
||||
protected void setDominantPlanStopTime(final boolean dominantPlanStopTime)
|
||||
{
|
||||
this.dominantPlanStopTime = dominantPlanStopTime;
|
||||
}
|
||||
|
||||
protected void setJsonGetStopsEncoding(Charset jsonGetStopsEncoding)
|
||||
protected void setJsonGetStopsEncoding(final Charset jsonGetStopsEncoding)
|
||||
{
|
||||
this.jsonGetStopsEncoding = jsonGetStopsEncoding;
|
||||
}
|
||||
|
||||
protected void setJsonNearbyStationsEncoding(Charset jsonNearbyStationsEncoding)
|
||||
protected void setJsonNearbyStationsEncoding(final Charset jsonNearbyStationsEncoding)
|
||||
{
|
||||
this.jsonNearbyStationsEncoding = jsonNearbyStationsEncoding;
|
||||
}
|
||||
|
||||
protected void setCanDoEquivs(final boolean canDoEquivs)
|
||||
{
|
||||
this.canDoEquivs = canDoEquivs;
|
||||
}
|
||||
|
||||
protected TimeZone timeZone()
|
||||
{
|
||||
return TimeZone.getTimeZone("CET");
|
||||
|
@ -611,11 +623,14 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final StringBuilder parameters = new StringBuilder();
|
||||
parameters.append("?productsFilter=").append(allProductsString());
|
||||
parameters.append("&boardType=dep");
|
||||
parameters.append("&disableEquivs=yes"); // don't use nearby stations
|
||||
if (canDoEquivs)
|
||||
parameters.append("&disableEquivs=yes"); // don't use nearby stations
|
||||
parameters.append("&maxJourneys=50"); // ignore maxDepartures because result contains other stations
|
||||
parameters.append("&start=yes");
|
||||
parameters.append("&L=vs_java3");
|
||||
parameters.append("&input=").append(stationId);
|
||||
if (clientType != null)
|
||||
parameters.append("&clientType=").append(ParserUtils.urlEncode(clientType));
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
|
|
@ -36,11 +36,17 @@ import de.schildbach.pte.dto.QueryDeparturesResult;
|
|||
public class SeProvider extends AbstractHafasProvider
|
||||
{
|
||||
public static final NetworkId NETWORK_ID = NetworkId.SE;
|
||||
private static final String API_BASE = "http://reseplanerare.resrobot.se/bin/"; // http://api.vasttrafik.se/bin/query.exe/sn
|
||||
private static final String API_BASE = "http://samtrafiken.hafas.de/bin/";
|
||||
|
||||
// http://reseplanerare.resrobot.se/bin/
|
||||
// http://api.vasttrafik.se/bin/
|
||||
|
||||
public SeProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/sn", API_BASE + "ajax-getstop.exe/sny", API_BASE + "query.exe/sn", 14, null, UTF_8, null);
|
||||
|
||||
setClientType("ANDROID");
|
||||
setCanDoEquivs(false);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue