parse next departures for connections

This commit is contained in:
Andreas Schildbach 2012-08-12 01:15:13 +02:00
parent d37af7e32c
commit d190ced050
2 changed files with 15 additions and 2 deletions

View file

@ -1675,6 +1675,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
uri.append("&locationServerActive=1");
uri.append("&useRealtime=1");
uri.append("&useProxFootSearch=1"); // walk if it makes journeys quicker
uri.append("&nextDepsPerLeg=1"); // next departure in case previous was missed
return uri.toString();
}
@ -2113,6 +2114,17 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
XmlPullUtil.exit(pp, "genAttrList");
}
if (XmlPullUtil.test(pp, "nextDeps"))
{
XmlPullUtil.enter(pp, "nextDeps");
while (XmlPullUtil.test(pp, "itdDateTime"))
{
processItdDateTime(pp, time);
final Date nextDepartureTime = time.getTime();
}
XmlPullUtil.exit(pp, "nextDeps");
}
final Line line = new Line(lineId, lineLabel, lineStyle(lineLabel), lineAttrs);
parts.add(new Connection.Trip(line, destination, departureTargetTime != null ? departureTargetTime : departureTime,

View file

@ -84,8 +84,9 @@ public class VvsProviderLiveTest extends AbstractProviderLiveTest
@Test
public void shortConnection() throws Exception
{
final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 0, null, "Hauptwache"), null, new Location(
LocationType.STATION, 0, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 5006118, 48782984, 9179846, "Stuttgart",
"Stuttgart, Hauptbahnhof"), null, new Location(LocationType.STATION, 5006024, 48782584, 9187098, "Stuttgart", "Staatsgalerie"),
new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
System.out.println(result);
final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true);
System.out.println(laterResult);