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: arrival.cpp
- Revision:
- 7:d713a0e47ffe
- Parent:
- 0:bf04f62339a4
diff -r dae1cdf19e90 -r d713a0e47ffe arrival.cpp --- a/arrival.cpp Mon Apr 25 14:41:42 2016 +0000 +++ b/arrival.cpp Tue Apr 26 13:03:09 2016 +0000 @@ -11,4 +11,23 @@ platform = std::string(_platform); operatorName = std::string(_operatorName); operatorCode = std::string(_operatorCode); -} \ No newline at end of file +} + +std::string Arrival::GetETAFormatted() +{ + if(eta == "Delayed") return "Unknown"; + else if(eta == "On time") return sta; + else return eta; +} + +bool Arrival::IsCancelled() +{ + if(eta == "Cancelled") return true; + else return false; +} + +bool Arrival::IsOnTime() +{ + if(eta == "On time") return true; + else return false; +} \ No newline at end of file