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

Embed: (wiki syntax)

« Back to documentation index

NR_Network_Conn Class Reference

NR_Network_Conn Class Reference

NR_Network_Conn Used for establishing a connection to the Huxley NR SOAP proxy and to generate departure/arrivals data. More...

#include <nr_network.h>

Public Member Functions

 NR_Network_Conn ()
 Make a connection.
 NR_Network_Conn (const char *address, const char *mask, const char *gateway)
 Make a connection.
TCPSocketConnection GetSocket ()
 Get the socket (an object of type TCPSocketConnection)
char * GetIP ()
 Get the IP address of the current connection.
int Connect (const char *url)
 Establish a connection to the API.
void Disconnect ()
 Disconnect from the API.
Arrival_Board GetArrivals (const std::string &code_stn, const std::string &number)
 Request a list of arrivals from the API and format them into an Arrival_Board object.
Departure_Board GetDepartures (const std::string &code_stn, const std::string &number)
 Request a list of departures from the API and format them into a Departure_Board object.

Detailed Description

NR_Network_Conn Used for establishing a connection to the Huxley NR SOAP proxy and to generate departure/arrivals data.

Definition at line 38 of file nr_network.h.


Constructor & Destructor Documentation

Make a connection.

The empty constructor creates a connection using DHCP.

Definition at line 27 of file nr_network.cpp.

NR_Network_Conn ( const char *  address,
const char *  mask,
const char *  gateway 
)

Make a connection.

This constructor creates a connection with the specified IP address, subnet and gateway

Parameters:
addressthe IP address of this device (in the format "192.168.1.101"
maskthe subnet mask of this device (in the format "255.255.255.0"
gatewaythe gatway of this device (in the format "192.168.1.1"

Definition at line 102 of file nr_network.cpp.


Member Function Documentation

int Connect ( const char *  url )

Establish a connection to the API.

Definition at line 111 of file nr_network.cpp.

void Disconnect (  )

Disconnect from the API.

Definition at line 138 of file nr_network.cpp.

Arrival_Board GetArrivals ( const std::string &  code_stn,
const std::string &  number 
)

Request a list of arrivals from the API and format them into an Arrival_Board object.

Parameters:
code_stnthe station code to get arrivals from
numberthe number of arrivals to retrieve
Returns:
an Arrival_Board object containing all the arrivals to this station
Departure_Board GetDepartures ( const std::string &  code_stn,
const std::string &  number 
)

Request a list of departures from the API and format them into a Departure_Board object.

Parameters:
code_stnthe station code to get departures from
numberthe number of departures to retrieve
Returns:
a Departure_Board object containing all the departures from this station
char * GetIP (  )

Get the IP address of the current connection.

Definition at line 97 of file nr_network.cpp.

TCPSocketConnection GetSocket (  )

Get the socket (an object of type TCPSocketConnection)

Definition at line 32 of file nr_network.cpp.