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

arrival.cpp

00001 #include "arrival.h"
00002 #include "MbedJSONValue.h"
00003 #include <string>
00004 
00005 Arrival::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)
00006 {
00007     crs = std::string(_crs);
00008     locationName = std::string(_locationName);
00009     sta = std::string(_sta);
00010     eta = std::string(_eta);
00011     platform = std::string(_platform);
00012     operatorName = std::string(_operatorName);
00013     operatorCode = std::string(_operatorCode);
00014 }
00015 
00016 std::string Arrival::GetETAFormatted()
00017 {
00018     if(eta == "Delayed") return "Unknown";
00019     else if(eta == "On time") return sta;
00020     else return eta;
00021 }    
00022 
00023 bool Arrival::IsCancelled()
00024 {
00025     if(eta == "Cancelled") return true;
00026     else return false;
00027 }    
00028 
00029 bool Arrival::IsOnTime()
00030 {
00031     if(eta == "On time") return true;
00032     else return false;
00033 }