mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 00:39:58 +00:00
Migrate Switzerland to binary trips query.
This commit is contained in:
parent
f7acf1f14f
commit
1be4366acb
3 changed files with 26 additions and 6 deletions
|
@ -19,13 +19,17 @@ package de.schildbach.pte;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import de.schildbach.pte.dto.Location;
|
import de.schildbach.pte.dto.Location;
|
||||||
import de.schildbach.pte.dto.LocationType;
|
import de.schildbach.pte.dto.LocationType;
|
||||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||||
import de.schildbach.pte.dto.Product;
|
import de.schildbach.pte.dto.Product;
|
||||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||||
|
import de.schildbach.pte.dto.QueryTripsContext;
|
||||||
|
import de.schildbach.pte.dto.QueryTripsResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
|
@ -35,12 +39,9 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
public static final NetworkId NETWORK_ID = NetworkId.SBB;
|
public static final NetworkId NETWORK_ID = NetworkId.SBB;
|
||||||
private static final String API_BASE = "http://fahrplan.sbb.ch/bin/";
|
private static final String API_BASE = "http://fahrplan.sbb.ch/bin/";
|
||||||
|
|
||||||
public SbbProvider(final String accessId)
|
public SbbProvider()
|
||||||
{
|
{
|
||||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10);
|
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10);
|
||||||
|
|
||||||
setAccessId(accessId);
|
|
||||||
setExtXmlEndpoint(API_BASE + "extxml.exe");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkId id()
|
public NetworkId id()
|
||||||
|
@ -142,6 +143,26 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
return Product.ALL;
|
return Product.ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendCustomTripsQueryBinaryUri(final StringBuilder uri)
|
||||||
|
{
|
||||||
|
uri.append("&h2g-direct=11");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryTripsResult queryTrips(final Location from, final Location via, final Location to, final Date date, final boolean dep,
|
||||||
|
final Collection<Product> products, final WalkSpeed walkSpeed, final Accessibility accessibility, final Set<Option> options)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
return queryTripsBinary(from, via, to, date, dep, products, walkSpeed, accessibility, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryTripsResult queryMoreTrips(final QueryTripsContext contextObj, final boolean later) throws IOException
|
||||||
|
{
|
||||||
|
return queryMoreTripsBinary(contextObj, later);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected char normalizeType(final String type)
|
protected char normalizeType(final String type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class SbbProviderLiveTest extends AbstractProviderLiveTest
|
||||||
{
|
{
|
||||||
public SbbProviderLiveTest()
|
public SbbProviderLiveTest()
|
||||||
{
|
{
|
||||||
super(new SbbProvider(Secrets.SBB_ACCESS_ID));
|
super(new SbbProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -22,6 +22,5 @@ package de.schildbach.pte.live;
|
||||||
*/
|
*/
|
||||||
public final class Secrets
|
public final class Secrets
|
||||||
{
|
{
|
||||||
public static final String SBB_ACCESS_ID = "insert your access id here";
|
|
||||||
public static final String VGN_API_BASE = "insert vgn base here";
|
public static final String VGN_API_BASE = "insert vgn base here";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue