mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29:51 +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.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.dto.QueryTripsContext;
|
||||
import de.schildbach.pte.dto.QueryTripsResult;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
|
@ -35,12 +39,9 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
public static final NetworkId NETWORK_ID = NetworkId.SBB;
|
||||
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);
|
||||
|
||||
setAccessId(accessId);
|
||||
setExtXmlEndpoint(API_BASE + "extxml.exe");
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
@ -142,6 +143,26 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
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
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ public class SbbProviderLiveTest extends AbstractProviderLiveTest
|
|||
{
|
||||
public SbbProviderLiveTest()
|
||||
{
|
||||
super(new SbbProvider(Secrets.SBB_ACCESS_ID));
|
||||
super(new SbbProvider());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -22,6 +22,5 @@ package de.schildbach.pte.live;
|
|||
*/
|
||||
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";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue