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.
departure_board.h@4:7e8a23454d85, 2016-04-21 (annotated)
- Committer:
- Leigh_LbR
- Date:
- Thu Apr 21 15:02:20 2016 +0000
- Revision:
- 4:7e8a23454d85
- Parent:
- 0:bf04f62339a4
- Child:
- 5:a4a33e6729c2
Finished documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Leigh_LbR | 0:bf04f62339a4 | 1 | #ifndef DEPARTURE_BOARD_H |
Leigh_LbR | 0:bf04f62339a4 | 2 | #define DEPARTURE_BOARD_H |
Leigh_LbR | 0:bf04f62339a4 | 3 | |
Leigh_LbR | 0:bf04f62339a4 | 4 | #include "departure.h" |
Leigh_LbR | 0:bf04f62339a4 | 5 | #include <string> |
Leigh_LbR | 0:bf04f62339a4 | 6 | |
Leigh_LbR | 4:7e8a23454d85 | 7 | /** Departure_Board |
Leigh_LbR | 4:7e8a23454d85 | 8 | * Contains information pertaining to an departure board; namely, a list of departures and a list of National Rail messages. |
Leigh_LbR | 4:7e8a23454d85 | 9 | */ |
Leigh_LbR | 0:bf04f62339a4 | 10 | class Departure_Board |
Leigh_LbR | 0:bf04f62339a4 | 11 | { |
Leigh_LbR | 0:bf04f62339a4 | 12 | public: |
Leigh_LbR | 0:bf04f62339a4 | 13 | Departure* departures; |
Leigh_LbR | 0:bf04f62339a4 | 14 | int num_departures; |
Leigh_LbR | 0:bf04f62339a4 | 15 | |
Leigh_LbR | 0:bf04f62339a4 | 16 | std::string* messages; |
Leigh_LbR | 0:bf04f62339a4 | 17 | int num_messages; |
Leigh_LbR | 0:bf04f62339a4 | 18 | |
Leigh_LbR | 4:7e8a23454d85 | 19 | /** Departure_Board constructor |
Leigh_LbR | 4:7e8a23454d85 | 20 | * @param _departures pointer to a list of departures |
Leigh_LbR | 4:7e8a23454d85 | 21 | * @param _num_departures number of departures in that list |
Leigh_LbR | 4:7e8a23454d85 | 22 | * @param _messages pointer to a list of messages |
Leigh_LbR | 4:7e8a23454d85 | 23 | * @param _num_messages number of messages in that list |
Leigh_LbR | 4:7e8a23454d85 | 24 | */ |
Leigh_LbR | 4:7e8a23454d85 | 25 | Departure_Board(Departure* _departures, const int& _num_departures, std::string* _messages, const int& _num_messages); |
Leigh_LbR | 4:7e8a23454d85 | 26 | /** Departure_Board default constructor |
Leigh_LbR | 4:7e8a23454d85 | 27 | */ |
Leigh_LbR | 0:bf04f62339a4 | 28 | Departure_Board(); |
Leigh_LbR | 4:7e8a23454d85 | 29 | /** Departure_Board destructor |
Leigh_LbR | 4:7e8a23454d85 | 30 | */ |
Leigh_LbR | 0:bf04f62339a4 | 31 | ~Departure_Board(); |
Leigh_LbR | 0:bf04f62339a4 | 32 | }; |
Leigh_LbR | 0:bf04f62339a4 | 33 | |
Leigh_LbR | 4:7e8a23454d85 | 34 | /** Creates a Departure_Board object from a JSON object string. Uses the MbedJSONValue library. |
Leigh_LbR | 4:7e8a23454d85 | 35 | * @param jsonObject the JSON object to be parsed |
Leigh_LbR | 4:7e8a23454d85 | 36 | * @return a Departure_Board object containing the information from the JSON object string |
Leigh_LbR | 4:7e8a23454d85 | 37 | */ |
Leigh_LbR | 0:bf04f62339a4 | 38 | Departure_Board depBoardFromJson(const std::string& jsonObject); |
Leigh_LbR | 0:bf04f62339a4 | 39 | |
Leigh_LbR | 0:bf04f62339a4 | 40 | #endif |