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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers departure.h Source File

departure.h

00001 #ifndef DEPARTURE_H
00002 #define DEPARTURE_H
00003 
00004 #include <string>
00005 
00006 /** Departure
00007 *   Stores a single departure
00008 */
00009 class Departure {
00010 public:
00011     std::string crs;
00012     std::string locationName;
00013     std::string std;
00014     std::string etd;
00015     std::string platform;
00016     std::string operatorName;
00017     std::string operatorCode;
00018     
00019     /** Empty Departure constructor
00020     */
00021     Departure() {};
00022     /** Departure constructor
00023     * @param _crs Station code (in NR style)
00024     * @param _locationName Location of departure (i.e. where the train is going)
00025     * @param _std Scheduled time of departure (in 24-hour format, i.e. "14:03")
00026     * @param _etd Estimated time of departure (in 24-hour format, "On time", "Delayed" or "Cancelled")
00027     * @param _platform Intended platform
00028     * @param _operatorName The train operating company operating the service
00029     * @param _operatorCode The train operating companies' NR code
00030     */
00031     Departure(const std::string& _crs, const std::string& _locationName, const std::string& _std, const std::string& _etd, const std::string& _platform, const std::string& _operatorName, const std::string& _operatorCode);
00032     
00033     /** Determine if the departure is delayed
00034     *   @return a boolean stating if the departure is delayed
00035     */
00036     bool IsDelayed();
00037     /** Determine if a departure is cancelled
00038     *   @return a boolean stating if the departure is cancelled
00039     */
00040     bool IsCancelled();
00041     /** Determine if a departure is on time
00042     *   @return a boolean stating if the departure is on time
00043     */
00044     bool IsOnTime();
00045     /** Get the estimated time of departure
00046     *   @return a time string with the estimated time of departure (in format "HH:MM"), the phrase "Unknown" if it is not known, or the phrase "Cancelled" if it is cancelled
00047     */
00048     std::string GetETDFormatted();
00049 };
00050 #endif