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.

/media/uploads/Leigh_LbR/nre_powered_logo.jpg

arrival.h

Committer:
Leigh_LbR
Date:
2016-05-24
Revision:
11:4532ff549fcf
Parent:
7:d713a0e47ffe

File content as of revision 11:4532ff549fcf:

#ifndef ARRIVAL_H
#define ARRIVAL_H

#include <string>

/** Arrival
*   Stores a single arrival
*/
class Arrival {
public:
    std::string crs;
    std::string locationName;
    std::string sta;
    std::string eta;
    std::string platform;
    std::string operatorName;
    std::string operatorCode;
    
    /** Empty Arrival constructor
    */
    Arrival() {};
    /** Arrival constructor
    * @param _crs Station code (in NR style)
    * @param _locationName Location of arrival (i.e. where the arrival comes from)
    * @param _sta Scheduled time of arrival (in 24-hour format, i.e. "14:03")
    * @param _eta Estimated time of arrival  (in 24-hour format, "On time", "Delayed" or "Cancelled")
    * @param _platform Intended platform
    * @param _operatorName The train operating company operating the service
    * @param _operatorCode The train operating companies' NR code
    */
    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);
    
    /** Determine if the arrival is delayed
    *   @return a boolean stating if the arrival is delayed
    */
    bool IsDelayed();
    /** Determine if a arrival is cancelled
    *   @return a boolean stating if the arrival is cancelled
    */
    bool IsCancelled();
    /** Determine if a arrival is on time
    *   @return a boolean stating if the arrival is on time
    */
    bool IsOnTime();
    /** Get the estimated time of arrival
    *   @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
    */
    std::string GetETAFormatted();
};
#endif