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.h
- Revision:
- 0:bf04f62339a4
- Child:
- 1:1de042ff6324
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nr_network.h Thu Apr 21 12:02:57 2016 +0000 @@ -0,0 +1,32 @@ +#ifndef NR_NETWORK_H +#define NR_NETWORK_H + +#include "EthernetInterface.h" +#include "arrival_board.h" +#include "departure_board.h" +#include <string> + +class Live_Info; + +class NR_Network_Conn +{ +private: + void init(const char* address, const char* mask, const char* gateway); + EthernetInterface conn; + TCPSocketConnection socket; + char _address[17]; + char _sub_mask[17]; + char _gateway[17]; + +public: + NR_Network_Conn(); + NR_Network_Conn(const char* address, const char* mask, const char* gateway); + TCPSocketConnection GetSocket(); + char* GetIP(); + int Connect(); + void Disconnect(); + Arrival_Board GetArrivals(const std::string& code_stn, const std::string& number); + Departure_Board GetDepartures(const std::string& code_stn, const std::string& number); +}; + +#endif \ No newline at end of file