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.
nr_network.h@0:bf04f62339a4, 2016-04-21 (annotated)
- Committer:
- Leigh_LbR
- Date:
- Thu Apr 21 12:02:57 2016 +0000
- Revision:
- 0:bf04f62339a4
- Child:
- 1:1de042ff6324
Created the Huxley Integration API. This links up to an implementation of the Huxley National Rail REST proxy to create an easy way to generate real-time departures/arrivals info easily on an mbed device.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Leigh_LbR | 0:bf04f62339a4 | 1 | #ifndef NR_NETWORK_H |
Leigh_LbR | 0:bf04f62339a4 | 2 | #define NR_NETWORK_H |
Leigh_LbR | 0:bf04f62339a4 | 3 | |
Leigh_LbR | 0:bf04f62339a4 | 4 | #include "EthernetInterface.h" |
Leigh_LbR | 0:bf04f62339a4 | 5 | #include "arrival_board.h" |
Leigh_LbR | 0:bf04f62339a4 | 6 | #include "departure_board.h" |
Leigh_LbR | 0:bf04f62339a4 | 7 | #include <string> |
Leigh_LbR | 0:bf04f62339a4 | 8 | |
Leigh_LbR | 0:bf04f62339a4 | 9 | class Live_Info; |
Leigh_LbR | 0:bf04f62339a4 | 10 | |
Leigh_LbR | 0:bf04f62339a4 | 11 | class NR_Network_Conn |
Leigh_LbR | 0:bf04f62339a4 | 12 | { |
Leigh_LbR | 0:bf04f62339a4 | 13 | private: |
Leigh_LbR | 0:bf04f62339a4 | 14 | void init(const char* address, const char* mask, const char* gateway); |
Leigh_LbR | 0:bf04f62339a4 | 15 | EthernetInterface conn; |
Leigh_LbR | 0:bf04f62339a4 | 16 | TCPSocketConnection socket; |
Leigh_LbR | 0:bf04f62339a4 | 17 | char _address[17]; |
Leigh_LbR | 0:bf04f62339a4 | 18 | char _sub_mask[17]; |
Leigh_LbR | 0:bf04f62339a4 | 19 | char _gateway[17]; |
Leigh_LbR | 0:bf04f62339a4 | 20 | |
Leigh_LbR | 0:bf04f62339a4 | 21 | public: |
Leigh_LbR | 0:bf04f62339a4 | 22 | NR_Network_Conn(); |
Leigh_LbR | 0:bf04f62339a4 | 23 | NR_Network_Conn(const char* address, const char* mask, const char* gateway); |
Leigh_LbR | 0:bf04f62339a4 | 24 | TCPSocketConnection GetSocket(); |
Leigh_LbR | 0:bf04f62339a4 | 25 | char* GetIP(); |
Leigh_LbR | 0:bf04f62339a4 | 26 | int Connect(); |
Leigh_LbR | 0:bf04f62339a4 | 27 | void Disconnect(); |
Leigh_LbR | 0:bf04f62339a4 | 28 | Arrival_Board GetArrivals(const std::string& code_stn, const std::string& number); |
Leigh_LbR | 0:bf04f62339a4 | 29 | Departure_Board GetDepartures(const std::string& code_stn, const std::string& number); |
Leigh_LbR | 0:bf04f62339a4 | 30 | }; |
Leigh_LbR | 0:bf04f62339a4 | 31 | |
Leigh_LbR | 0:bf04f62339a4 | 32 | #endif |