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

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

File content as of revision 11:4532ff549fcf:

#include "arrival.h"
#include "MbedJSONValue.h"
#include <string>

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)
{
    crs = std::string(_crs);
    locationName = std::string(_locationName);
    sta = std::string(_sta);
    eta = std::string(_eta);
    platform = std::string(_platform);
    operatorName = std::string(_operatorName);
    operatorCode = std::string(_operatorCode);
}

std::string Arrival::GetETAFormatted()
{
    if(eta == "Delayed") return "Unknown";
    else if(eta == "On time") return sta;
    else return eta;
}    

bool Arrival::IsCancelled()
{
    if(eta == "Cancelled") return true;
    else return false;
}    

bool Arrival::IsOnTime()
{
    if(eta == "On time") return true;
    else return false;
}