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.cpp Source File

departure.cpp

00001 #include "departure.h"
00002 #include <string>
00003 
00004 Departure::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)
00005 {
00006     crs = std::string(_crs);
00007     locationName = std::string(_locationName);
00008     std = std::string(_std);
00009     etd = std::string(_etd);
00010     platform = std::string(_platform);
00011     operatorName = std::string(_operatorName);
00012     operatorCode = std::string(_operatorCode);
00013 };
00014 
00015 bool Departure::IsDelayed()
00016 {
00017     if(etd == "On time") return false;
00018     else if(etd == "Cancelled") return false;
00019     else return true;
00020 }   
00021 
00022 std::string Departure::GetETDFormatted()
00023 {
00024     if(etd == "Delayed") return "Unknown";
00025     else if(etd == "On time") return std;
00026     else return etd;
00027 }    
00028 
00029 bool Departure::IsCancelled()
00030 {
00031     if(etd == "Cancelled") return true;
00032     else return false;
00033 }    
00034 
00035 bool Departure::IsOnTime()
00036 {
00037     if(etd == "On time") return true;
00038     else return false;
00039 }