2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
6 Sami Rämö - sami.ramo@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #ifndef ROUTINGSERVICE_H
24 #define ROUTINGSERVICE_H
32 class NetworkAccessManager;
36 * @brief RoutingService class for communicating with CloudMade server
37 * and parsing routing data
39 * @author Henri Lampela - henri.lampela@ixonos.com
40 * @author Sami Rämö - sami.ramo@ixonos.com
42 class RoutingService : public QObject
48 * @brief Default constructor
50 * @param parent instance of parent
52 RoutingService(QObject *parent = 0);
54 /*******************************************************************************
55 * MEMBER FUNCTIONS AND SLOTS
56 ******************************************************************************/
59 * @brief Public slot, which indicates when http request has been completed
61 * @param reply storage for http reply
63 void requestFinished(QNetworkReply *reply);
66 * @brief Request routing information from the server
68 * @param from Start point of the route
69 * @param to End point of the route
71 void requestRoute(const GeoCoordinate &from, const GeoCoordinate &to);
75 * @brief Parses routing data from JSON string
77 * @param jsonReply JSON string
79 void parseRouteData(const QByteArray &jsonReply);
82 * @brief Request authorization token
85 void requestAuthorizationToken();
88 * @brief Sends http request
90 * @param url destination
92 void sendRequest(const QUrl &url);
94 /*******************************************************************************
96 ******************************************************************************/
99 * @brief Signals error
101 * @param context error context
102 * @param error error code
104 void error(const int context, const int error);
107 * @brief Emited when route is parsed and is ready for further processing
109 * @param route Route item containing parsed route details
111 void routeParsed(Route &route);
113 /*******************************************************************************
115 ******************************************************************************/
117 QString m_pendingRequest; ///< Placeholder for pending route request
118 QString m_token; ///< Placeholder for authentication token
120 NetworkAccessManager *m_networkManager; ///< Pointer to QNetworkAccessManager
123 #endif // ROUTINGSERVICE_H