Reading Buses API V3.0.0
A C#, .net Standard Library for the Reading Buses Open Data API (https://reading-opendata.r2p.com/), available to use in your C# console, WPF, UWP or Win Form Applications.
ReadingBusesAPI.VehiclePositions.GpsController Class Reference

Helps get live and historical GPS data on vehicles by accessing the "Live Vehicle Positions" API. More...

Public Member Functions

async Task< VehiclePosition[]> GetArchivedVehiclePositions (DateTime dateStartTime, TimeSpan timeSpan)
 Gets historic/archived GPS data for buses on a specific date, filtered either by vehicle ID, or all buses without a time period or both. GPS data is not stored for as long as other forms of data you may fail to get data older than a few months. More...
 
async Task< VehiclePosition[]> GetArchivedVehiclePositions (DateTime dateStartTime, TimeSpan timeSpan, string vehicle)
 Gets historic/archived GPS data for buses on a specific date, filtered either by vehicle ID, or all buses without a time period or both. GPS data is not stored for as long as other forms of data you may fail to get data older than a few months. More...
 
async Task< LiveVehiclePosition[]> GetLiveVehiclePositions ()
 Gets live GPS data for all buses currently operating. More...
 
async Task< LiveVehiclePositionGetLiveVehiclePosition (string vehicle)
 Gets live GPS data for a single buses matching Vehicle ID number. More...
 
async Task< bool > IsVehicle (string vehicle)
 Checks if the Vehicle ID Number is currently in service right now. More...
 

Package Functions

 GpsController ()
 Creates a GPS Controller, you should not need to make your own GPS controller, you can get an instance of one via the main 'ReadingBuses' object. More...
 

Detailed Description

Helps get live and historical GPS data on vehicles by accessing the "Live Vehicle Positions" API.

Constructor & Destructor Documentation

◆ GpsController()

ReadingBusesAPI.VehiclePositions.GpsController.GpsController ( )
package

Creates a GPS Controller, you should not need to make your own GPS controller, you can get an instance of one via the main 'ReadingBuses' object.

Member Function Documentation

◆ GetArchivedVehiclePositions() [1/2]

async Task< VehiclePosition[]> ReadingBusesAPI.VehiclePositions.GpsController.GetArchivedVehiclePositions ( DateTime  dateStartTime,
TimeSpan  timeSpan 
)

Gets historic/archived GPS data for buses on a specific date, filtered either by vehicle ID, or all buses without a time period or both. GPS data is not stored for as long as other forms of data you may fail to get data older than a few months.

Parameters
dateStartTimeVehicle ID Number eg 414
timeSpan(optional) How long a period do you want data for, you can not get multiple days worth of data. If you ask this your result will be automatically truncated to only the start date to midnight.
Returns
An array of GPS locations at a previous date.
Exceptions
ReadingBusesApiExceptionMalformedQueryThrown if, you have not choose a date in the past, or the date is too far in the past and so no data exists. Thrown if you have not filtered by either 'timeSpan' or 'vehicle' ID or both. Thrown if the API key is invalid or expired.
ReadingBusesApiExceptionBadQueryThrown if the API responds with an error message.
ReadingBusesApiExceptionCriticalThrown if the API fails, but provides no reason.

See GpsController.GetLiveVehiclePositions() to get live data instead.

◆ GetArchivedVehiclePositions() [2/2]

async Task< VehiclePosition[]> ReadingBusesAPI.VehiclePositions.GpsController.GetArchivedVehiclePositions ( DateTime  dateStartTime,
TimeSpan  timeSpan,
string  vehicle 
)

Gets historic/archived GPS data for buses on a specific date, filtered either by vehicle ID, or all buses without a time period or both. GPS data is not stored for as long as other forms of data you may fail to get data older than a few months.

Parameters
dateStartTimeVehicle ID Number eg 414
timeSpan(optional) How long a period do you want data for, you can not get multiple days worth of data. If you ask this your result will be automatically truncated to only the start date to midnight.
vehicle(optional) Vehicle ID Number eg 414
Returns
An array of GPS locations at a previous date.
Exceptions
ReadingBusesApiExceptionMalformedQueryThrown if, you have not choose a date in the past, or the date is too far in the past and so no data exists. Thrown if you have not filtered by either 'timeSpan' or 'vehicle' ID or both. Thrown if the API key is invalid or expired.
ReadingBusesApiExceptionBadQueryThrown if the API responds with an error message.
ReadingBusesApiExceptionCriticalThrown if the API fails, but provides no reason.

See GpsController.GetLiveVehiclePositions() to get live data instead.

◆ GetLiveVehiclePosition()

async Task< LiveVehiclePosition > ReadingBusesAPI.VehiclePositions.GpsController.GetLiveVehiclePosition ( string  vehicle)

Gets live GPS data for a single buses matching Vehicle ID number.

Parameters
vehicleVehicle ID Number eg 414
Returns
The GPS point of Vehicle matching your ID provided.
Exceptions
ReadingBusesApiExceptionBadQueryThrown if a vehicle of the ID does not exist or is not currently active. You can check by using the 'IsVehicle' function.

◆ GetLiveVehiclePositions()

async Task< LiveVehiclePosition[]> ReadingBusesAPI.VehiclePositions.GpsController.GetLiveVehiclePositions ( )

Gets live GPS data for all buses currently operating.

Returns
An array of GPS locations for all buses operating by Reading Buses currently
Exceptions
ReadingBusesApiExceptionBadQueryThrown if the API key is invalid or expired.
ReadingBusesApiExceptionCriticalThrown if the API fails, but provides no reason.

◆ IsVehicle()

async Task< bool > ReadingBusesAPI.VehiclePositions.GpsController.IsVehicle ( string  vehicle)

Checks if the Vehicle ID Number is currently in service right now.

Parameters
vehicleVehicle ID Number eg 414
Returns
True or False for if the buses GPS can be found or not currently.

The documentation for this class was generated from the following file: