API for linking to the Huxley National Rail REST proxy for the retrieval of live National Rail data. Still needs work (sadly), but works well for the time being!
Dependencies: EthernetInterface
National Rail Huxley Integration Interface
This API provides a clear link between the National Rail Huxley Integration JSON interface (available at https://huxley.unop.uk/), and mbed devices, over an Ethernet connection. This project is still very much a work-in-progress, but hopefully I will be able to provide a comprehensive method of retrieving live National Rail departures data in a simple and effective way.
Diff: departure.cpp
- Revision:
- 7:d713a0e47ffe
- Parent:
- 0:bf04f62339a4
diff -r dae1cdf19e90 -r d713a0e47ffe departure.cpp --- a/departure.cpp Mon Apr 25 14:41:42 2016 +0000 +++ b/departure.cpp Tue Apr 26 13:03:09 2016 +0000 @@ -10,4 +10,30 @@ platform = std::string(_platform); operatorName = std::string(_operatorName); operatorCode = std::string(_operatorCode); -}; \ No newline at end of file +}; + +bool Departure::IsDelayed() +{ + if(etd == "On time") return false; + else if(etd == "Cancelled") return false; + else return true; +} + +std::string Departure::GetETDFormatted() +{ + if(etd == "Delayed") return "Unknown"; + else if(etd == "On time") return std; + else return etd; +} + +bool Departure::IsCancelled() +{ + if(etd == "Cancelled") return true; + else return false; +} + +bool Departure::IsOnTime() +{ + if(etd == "On time") return true; + else return false; +} \ No newline at end of file