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.
arrival_board.h@11:4532ff549fcf, 2016-05-24 (annotated)
- Committer:
- Leigh_LbR
- Date:
- Tue May 24 15:17:38 2016 +0000
- Revision:
- 11:4532ff549fcf
- Parent:
- 6:dae1cdf19e90
Fixed a small glitch with NR_Network.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Leigh_LbR | 1:1de042ff6324 | 1 | #ifndef ARRIVAL_BOARD_H |
Leigh_LbR | 1:1de042ff6324 | 2 | #define ARRIVAL_BOARD_H |
Leigh_LbR | 0:bf04f62339a4 | 3 | |
Leigh_LbR | 6:dae1cdf19e90 | 4 | #include "MbedJSONValue.h" |
Leigh_LbR | 0:bf04f62339a4 | 5 | #include "arrival.h" |
Leigh_LbR | 0:bf04f62339a4 | 6 | #include <string> |
Leigh_LbR | 0:bf04f62339a4 | 7 | |
Leigh_LbR | 3:a287e75a2121 | 8 | /** Arrival_Board |
Leigh_LbR | 3:a287e75a2121 | 9 | * Contains information pertaining to an arrival board; namely, a list of arrivals and a list of National Rail messages. |
Leigh_LbR | 3:a287e75a2121 | 10 | */ |
Leigh_LbR | 0:bf04f62339a4 | 11 | class Arrival_Board |
Leigh_LbR | 0:bf04f62339a4 | 12 | { |
Leigh_LbR | 0:bf04f62339a4 | 13 | public: |
Leigh_LbR | 0:bf04f62339a4 | 14 | Arrival* arrivals; |
Leigh_LbR | 0:bf04f62339a4 | 15 | int num_arrivals; |
Leigh_LbR | 0:bf04f62339a4 | 16 | |
Leigh_LbR | 0:bf04f62339a4 | 17 | std::string* messages; |
Leigh_LbR | 0:bf04f62339a4 | 18 | int num_messages; |
Leigh_LbR | 0:bf04f62339a4 | 19 | |
Leigh_LbR | 4:7e8a23454d85 | 20 | /** Arrival_Board constructor |
Leigh_LbR | 4:7e8a23454d85 | 21 | * @param _arrivals pointer to a list of arrivals |
Leigh_LbR | 4:7e8a23454d85 | 22 | * @param _num_arrivals number of arrivals in that list |
Leigh_LbR | 4:7e8a23454d85 | 23 | * @param _messages pointer to a list of messages |
Leigh_LbR | 4:7e8a23454d85 | 24 | * @param _num_messages number of messages in that list |
Leigh_LbR | 4:7e8a23454d85 | 25 | */ |
Leigh_LbR | 3:a287e75a2121 | 26 | Arrival_Board(Arrival* _arrivals, const int& _num_arrivals, std::string* _messages, const int& _num_messages); |
Leigh_LbR | 4:7e8a23454d85 | 27 | /** Arrival_Board default constructor |
Leigh_LbR | 4:7e8a23454d85 | 28 | */ |
Leigh_LbR | 5:a4a33e6729c2 | 29 | Arrival_Board() {}; |
Leigh_LbR | 0:bf04f62339a4 | 30 | |
Leigh_LbR | 4:7e8a23454d85 | 31 | /** Arrival_Board destructor |
Leigh_LbR | 4:7e8a23454d85 | 32 | */ |
Leigh_LbR | 0:bf04f62339a4 | 33 | ~Arrival_Board(); |
Leigh_LbR | 0:bf04f62339a4 | 34 | }; |
Leigh_LbR | 0:bf04f62339a4 | 35 | |
Leigh_LbR | 4:7e8a23454d85 | 36 | /** Creates an Arrival_Board object from a JSON object string. Uses the MbedJSONValue library. |
Leigh_LbR | 4:7e8a23454d85 | 37 | * @param jsonObject the JSON object to be parsed |
Leigh_LbR | 4:7e8a23454d85 | 38 | * @return an Arrival_Board object containing the information from the JSON object string |
Leigh_LbR | 4:7e8a23454d85 | 39 | */ |
Leigh_LbR | 0:bf04f62339a4 | 40 | Arrival_Board arrBoardFromJson(const std::string& jsonObject); |
Leigh_LbR | 0:bf04f62339a4 | 41 | |
Leigh_LbR | 0:bf04f62339a4 | 42 | #endif |