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.
Diff: nr_network.cpp
- Revision:
- 1:1de042ff6324
- Parent:
- 0:bf04f62339a4
- Child:
- 8:6e063a3827c0
--- a/nr_network.cpp Thu Apr 21 12:02:57 2016 +0000 +++ b/nr_network.cpp Thu Apr 21 12:32:32 2016 +0000 @@ -1,13 +1,15 @@ -#include "nr_network.h" #include "departure_board.h" #include "arrival_board.h" +#include "nr_network.h" #include <string> +#include <vector> #ifndef nullptr #define nullptr 0 // nullptr is undefined by default... #endif using std::string; +using std::vector; /* * Initialise the network connection with the required attributes. @@ -46,7 +48,7 @@ int ret; while(true) { - ret = conn.GetSocket().receive(buf, sizeof(buf) - 1); + ret = socket.receive(buf, sizeof(buf) - 1); if(ret <= 0){ json.append(buf); break; @@ -56,7 +58,7 @@ memset(buf, '\0', 1000); } - Departure_Board dep = boardFromJson(json); + Departure_Board dep = depBoardFromJson(json); return dep; }