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

Committer:
Leigh_LbR
Date:
Tue May 24 15:17:38 2016 +0000
Revision:
11:4532ff549fcf
Parent:
7:d713a0e47ffe
Fixed a small glitch with NR_Network.cpp

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Leigh_LbR 0:bf04f62339a4 1 #include "arrival.h"
Leigh_LbR 0:bf04f62339a4 2 #include "MbedJSONValue.h"
Leigh_LbR 0:bf04f62339a4 3 #include <string>
Leigh_LbR 0:bf04f62339a4 4
Leigh_LbR 0:bf04f62339a4 5 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)
Leigh_LbR 0:bf04f62339a4 6 {
Leigh_LbR 0:bf04f62339a4 7 crs = std::string(_crs);
Leigh_LbR 0:bf04f62339a4 8 locationName = std::string(_locationName);
Leigh_LbR 0:bf04f62339a4 9 sta = std::string(_sta);
Leigh_LbR 0:bf04f62339a4 10 eta = std::string(_eta);
Leigh_LbR 0:bf04f62339a4 11 platform = std::string(_platform);
Leigh_LbR 0:bf04f62339a4 12 operatorName = std::string(_operatorName);
Leigh_LbR 0:bf04f62339a4 13 operatorCode = std::string(_operatorCode);
Leigh_LbR 7:d713a0e47ffe 14 }
Leigh_LbR 7:d713a0e47ffe 15
Leigh_LbR 7:d713a0e47ffe 16 std::string Arrival::GetETAFormatted()
Leigh_LbR 7:d713a0e47ffe 17 {
Leigh_LbR 7:d713a0e47ffe 18 if(eta == "Delayed") return "Unknown";
Leigh_LbR 7:d713a0e47ffe 19 else if(eta == "On time") return sta;
Leigh_LbR 7:d713a0e47ffe 20 else return eta;
Leigh_LbR 7:d713a0e47ffe 21 }
Leigh_LbR 7:d713a0e47ffe 22
Leigh_LbR 7:d713a0e47ffe 23 bool Arrival::IsCancelled()
Leigh_LbR 7:d713a0e47ffe 24 {
Leigh_LbR 7:d713a0e47ffe 25 if(eta == "Cancelled") return true;
Leigh_LbR 7:d713a0e47ffe 26 else return false;
Leigh_LbR 7:d713a0e47ffe 27 }
Leigh_LbR 7:d713a0e47ffe 28
Leigh_LbR 7:d713a0e47ffe 29 bool Arrival::IsOnTime()
Leigh_LbR 7:d713a0e47ffe 30 {
Leigh_LbR 7:d713a0e47ffe 31 if(eta == "On time") return true;
Leigh_LbR 7:d713a0e47ffe 32 else return false;
Leigh_LbR 7:d713a0e47ffe 33 }