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.
arrival.h@11:4532ff549fcf, 2016-05-24 (annotated)
- Committer:
- Leigh_LbR
- Date:
- Tue May 24 15:17:38 2016 +0000
- Revision:
- 11:4532ff549fcf
- Parent:
- 7:d713a0e47ffe
Fixed a small glitch with NR_Network.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Leigh_LbR | 1:1de042ff6324 | 1 | #ifndef ARRIVAL_H |
Leigh_LbR | 1:1de042ff6324 | 2 | #define ARRIVAL_H |
Leigh_LbR | 0:bf04f62339a4 | 3 | |
Leigh_LbR | 0:bf04f62339a4 | 4 | #include <string> |
Leigh_LbR | 0:bf04f62339a4 | 5 | |
Leigh_LbR | 2:071bf3c7f2a2 | 6 | /** Arrival |
Leigh_LbR | 2:071bf3c7f2a2 | 7 | * Stores a single arrival |
Leigh_LbR | 2:071bf3c7f2a2 | 8 | */ |
Leigh_LbR | 0:bf04f62339a4 | 9 | class Arrival { |
Leigh_LbR | 0:bf04f62339a4 | 10 | public: |
Leigh_LbR | 0:bf04f62339a4 | 11 | std::string crs; |
Leigh_LbR | 0:bf04f62339a4 | 12 | std::string locationName; |
Leigh_LbR | 0:bf04f62339a4 | 13 | std::string sta; |
Leigh_LbR | 0:bf04f62339a4 | 14 | std::string eta; |
Leigh_LbR | 0:bf04f62339a4 | 15 | std::string platform; |
Leigh_LbR | 0:bf04f62339a4 | 16 | std::string operatorName; |
Leigh_LbR | 0:bf04f62339a4 | 17 | std::string operatorCode; |
Leigh_LbR | 0:bf04f62339a4 | 18 | |
Leigh_LbR | 3:a287e75a2121 | 19 | /** Empty Arrival constructor |
Leigh_LbR | 3:a287e75a2121 | 20 | */ |
Leigh_LbR | 0:bf04f62339a4 | 21 | Arrival() {}; |
Leigh_LbR | 3:a287e75a2121 | 22 | /** Arrival constructor |
Leigh_LbR | 3:a287e75a2121 | 23 | * @param _crs Station code (in NR style) |
Leigh_LbR | 3:a287e75a2121 | 24 | * @param _locationName Location of arrival (i.e. where the arrival comes from) |
Leigh_LbR | 3:a287e75a2121 | 25 | * @param _sta Scheduled time of arrival (in 24-hour format, i.e. "14:03") |
Leigh_LbR | 3:a287e75a2121 | 26 | * @param _eta Estimated time of arrival (in 24-hour format, "On time", "Delayed" or "Cancelled") |
Leigh_LbR | 3:a287e75a2121 | 27 | * @param _platform Intended platform |
Leigh_LbR | 3:a287e75a2121 | 28 | * @param _operatorName The train operating company operating the service |
Leigh_LbR | 3:a287e75a2121 | 29 | * @param _operatorCode The train operating companies' NR code |
Leigh_LbR | 3:a287e75a2121 | 30 | */ |
Leigh_LbR | 0:bf04f62339a4 | 31 | Arrival(const std::string& _crs, const std::string& _locationName, const std::string& _sta, const std::string& _eta, const std::string& _platform, const std::string& _operatorName, const std::string& _operatorCode); |
Leigh_LbR | 7:d713a0e47ffe | 32 | |
Leigh_LbR | 7:d713a0e47ffe | 33 | /** Determine if the arrival is delayed |
Leigh_LbR | 7:d713a0e47ffe | 34 | * @return a boolean stating if the arrival is delayed |
Leigh_LbR | 7:d713a0e47ffe | 35 | */ |
Leigh_LbR | 7:d713a0e47ffe | 36 | bool IsDelayed(); |
Leigh_LbR | 7:d713a0e47ffe | 37 | /** Determine if a arrival is cancelled |
Leigh_LbR | 7:d713a0e47ffe | 38 | * @return a boolean stating if the arrival is cancelled |
Leigh_LbR | 7:d713a0e47ffe | 39 | */ |
Leigh_LbR | 7:d713a0e47ffe | 40 | bool IsCancelled(); |
Leigh_LbR | 7:d713a0e47ffe | 41 | /** Determine if a arrival is on time |
Leigh_LbR | 7:d713a0e47ffe | 42 | * @return a boolean stating if the arrival is on time |
Leigh_LbR | 7:d713a0e47ffe | 43 | */ |
Leigh_LbR | 7:d713a0e47ffe | 44 | bool IsOnTime(); |
Leigh_LbR | 7:d713a0e47ffe | 45 | /** Get the estimated time of arrival |
Leigh_LbR | 7:d713a0e47ffe | 46 | * @return a time string with the estimated time of arrival (in format "HH:MM"), the phrase "Unknown" if it is not known, or the phrase "Cancelled" if it is cancelled |
Leigh_LbR | 7:d713a0e47ffe | 47 | */ |
Leigh_LbR | 7:d713a0e47ffe | 48 | std::string GetETAFormatted(); |
Leigh_LbR | 0:bf04f62339a4 | 49 | }; |
Leigh_LbR | 0:bf04f62339a4 | 50 | #endif |