This project is read-only.
How it works
The library uses XML serialisation to extract objects from the REST API.
It then uses the Reactive Extensions system to publish these objects.
There are four feeds provided by the library
  • Line Status
  • Station Incidents
  • Station Names
  • Train Prediction
  • Station Arrivals - This uses the Tfl Train prediction REST API to provide information on arrivals for a specified station

Example code


CancellationTokenSource token = new CancellationTokenSource();
TfL.TrackerNet tracker = new TrackerNet("", "");

Line Status

var lineStatus = from s in tracker.LineStatus.Poll(token.Token, 1000)
                             select s;
lineStatus.Subscribe((status)=> status.ForEach(System.Console.WriteLine));

Station Status

var feed = from s in tracker.StationStatus.IncidentsOnly.Poll(token.Token, 30000)
                 select s;

Station Names

var stationNames = tracker.StationNames.Poll();

Train times ( per line, filtered by station)

var trainTimes = from t in tracker.TrainTimes("District").Poll()
                       where t.Name == "Victoria."
                       select t;

Train times ( specified station, all lines)

var stationTimes = from t in tracker.StationArrivals("Victoria").Poll()
                           select t;

Poll method

There are two overloads of the Poll method. With no parameters the API is polled only once.
The other overload runs a task periodically using the period parameter. A cancellation token is used to cancel this operation.

Last edited Dec 29, 2011 at 12:56 PM by msrushton, version 2


No comments yet.