aboutsummaryrefslogtreecommitdiff
path: root/dbfp.c
Commit message (Collapse)AuthorAge
* dbfp: use HTTPS instead of HTTPRobin Krahl2017-01-14
| | | | | | The REST API seems to be no longer available via HTTP, but only via HTTPS. Therefore the URL is changed to the HTTPS scheme, and the CURL initialization is adapted to include SSL initialization.
* dbfp_query_departure: remove location argument, only use location_idRobin Krahl2016-06-10
|
* dbfp: rename dbfp_query_location_name to dbfp_query_locationRobin Krahl2016-06-06
|
* dbfp: implement dbfp_query_departureRobin Krahl2016-06-01
| | | | | Retrieves the next departures of a given station. The time handling needs to be checked, as the DB API always uses Europe/Berlin.
* dbfp: remove unnecessary argument from dbfp_format_urlRobin Krahl2016-06-01
|
* dbfp: move handling of parse_data to dbfp_requestRobin Krahl2016-06-01
|
* dbfp: move URL formatting to dbfp_format_urlRobin Krahl2016-06-01
|
* dbfp: refactoring: introduce generic object parserRobin Krahl2016-05-31
| | | | | | | This commit replaces the manual parsing of the XML location element with a generic read_object method. The structure of the element to parse and the destination of the parsed data is defined in an object_data array.
* dbfp: introduce dbfp_departure and dbfp_departure_closeRobin Krahl2016-03-10
| | | | | | | The dbfp_departure structure stores a single departure with its metadata. The dbfp_departure_close function releases the resources allocated by a dbfp_departure structure, but does not free the structure itself.
* dbfp: introduce dbfp_location_closeRobin Krahl2016-03-10
| | | | | dbfp_location_close releases the resources allocated by a dbfp_location structure. It does not free the structure itself.
* dbfp: URL-encode the input for the location queryRobin Krahl2016-03-10
| | | | | | In dbfp_query_location_name, URL-encode the input string using curl before sending the HTTP request. This fixes the issue that input strings with non-URL characters leed to empty results.
* dbfp: move curl handle to dbfpRobin Krahl2016-03-10
| | | | | As the curl handle can be reused between requests, it is moved to the dbfp structure, initialized in dbfp_init and freed in dbfp_close.
* dbfp: add lon and lat to dbfp_location and to the queryRobin Krahl2016-03-10
| | | | | | The location.name query (dbfp_query_location_name) also returns the coordinates of the location. This commit adds them to the dbfp_location structure and to the query itself.
* dbfp: improve error handlingRobin Krahl2016-03-10
| | | | | | | | Get rid of the complicated dbfp_status structure and use plain old return codes. This leads to a cleaner interface and fixes the problem with unsufficient error handling introduced with 1648e81. The drawback is that the details of curl and expat errors are hidden from the user, but this can be adressed later.
* dbfp: init and cleanup curl in dbfp_init and dbfp_closeRobin Krahl2016-03-09
| | | | | dbfp_query_location_name will not be the only function that needs curl, but it is not necessary to initialize and cleanup curl more than once.
* dbfp: fix error handling in dbfp_query_location_nameRobin Krahl2016-03-09
| | | | | | The old code returned a successful status, but does not set the result values if there are no results. This patch changes the error handling so that the results are always set if no error occured.
* add rudimentary location supportRobin Krahl2016-03-08
| | | | | | | | | | | The function dbfp_query_location_name performs the location.name query and returns a list of all stations that match the search term. The implementation has two flaws: there is no URL encoding, and malformatted query results will not lead to a meaningful error message. There are two new test cases: basic tests some basic functionality, as setting the API key and accessing the API. location adds a simple test for the location.name query.
* initial commitRobin Krahl2016-02-26