Added capability to process mapzen route reponse
[platform/core/location/maps-plugin-mapzen.git] / src / mapzen / mapzen_types.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _MAPZEN_TYPES_H_
18 #define _MAPZEN_TYPES_H_
19
20 #include <glib.h>
21
22 typedef enum {
23         MAPZEN_ERROR_NONE = 0,                /**< Successful */
24         MAPZEN_ERROR_PERMISSION_DENIED,       /**< Permission Denied */
25         MAPZEN_ERROR_OUT_OF_MEMORY,           /**< Out of memory */
26         MAPZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
27         MAPZEN_ERROR_NOT_SUPPORTED,           /**< Not supported */
28         MAPZEN_ERROR_CONNECTION_TIMED_OUT,    /**< Timeout error, no answer */
29         MAPZEN_ERROR_NETWORK_UNREACHABLE,     /**< Network unavailable */
30         MAPZEN_ERROR_INVALID_OPERATION,       /**< Opeartion is not valid */
31         MAPZEN_ERROR_KEY_NOT_AVAILABLE,       /**< Invalid key */
32         MAPZEN_ERROR_RESOURCE_BUSY,           /**< Resource busy */
33         MAPZEN_ERROR_CANCELED,                /**< Service canceled */
34         MAPZEN_ERROR_UNKNOWN,                 /**< Unknown error */
35         MAPZEN_ERROR_SERVICE_NOT_AVAILABLE,   /**< Service unavailabe*/
36         MAPZEN_ERROR_NOT_FOUND,               /**< Result not found */
37 } mapzen_error_e;
38
39 typedef enum {
40         MAPZEN_BOUNDARY_NONE = 0,       /*  Undefined geographical area type. */
41         MAPZEN_BOUNDARY_RECT,           /*  Rectangular geographical area type. */
42         MAPZEN_BOUNDARY_CIRCLE, /*  Circle geographical area type. */
43 } boundary_type;
44
45 typedef enum {
46         COSTING_AUTO = 0,
47         COSTING_AUTO_SHORTER,
48         COSTING_BICYCLE,
49         COSTING_MULTIMODAL,
50         COSTING_PEDESTRIAN
51 } route_type;
52
53 typedef enum {
54         UNIT_KM /* for kilometers */
55 } route_unit;
56
57 typedef enum {
58         PENALTY_NONE = 0, //TODO: Mapzen does not have currently
59         PENALTY_LIMITED_ACCESS, //TODO: Mapzen does not have currently
60         PENALTY_TOLL_ROADS, //set to > 0 to avoid
61         PENALTY_USE_FERRY, //This is range of values between 0 and 1. Values near 0 attempt to avoid ferries and
62                                  //values near 1 will favor ferries.
63         PENALTY_USE_UNPAVED, //TODO: Mapzen does not have currently
64         PENALTY_SEASONAL_CLOSURE, //TODO: Mapzen does not have currently
65         PENALTY_COUNTRY_CROSSING // set to > 0 to avoid
66 } route_feature_avoids;
67
68 typedef enum {
69         DRIVING_STYLE_NORMAL = 0,
70         DRIVING_STYLE_CAUTIOUS,
71         DRIVING_STYLE_AGGRESSIVE
72 } route_driving_style;
73
74 typedef enum {
75         TANGRAM_VIEW_NORMAL = 0,
76         TANGRAM_VIEW_TERRAIN,
77         TANGRAM_VIEW_SATELLITE,
78         TANGRAM_VIEW_HYBRID,
79         TANGRAM_VIEW_NOT_SUPPORTED
80 } tangram_view_type;
81
82 typedef struct {
83         gdouble latitude;
84         gdouble longitude;
85 } coords_s;
86
87 typedef struct {
88         coords_s top_left;
89         coords_s bottom_right;
90 } rectangle_s;
91
92 typedef struct {
93         coords_s center;
94         gdouble radius;
95 } circle_s;
96
97 typedef struct {
98         boundary_type type;
99         union {
100                 rectangle_s rect;
101                 circle_s circle;
102         };
103 } mapzen_boundary_s;
104
105 typedef struct {
106         gchar *maps_key;
107         gchar *address;
108         mapzen_boundary_s *boundary;
109         gint num_res;
110 } mapzen_geocode_req_s;
111
112 typedef struct {
113         gchar *maps_key;
114         gint num_res;
115         coords_s coordinates;
116 } mapzen_revgeocode_req_s;
117
118 typedef struct {
119         gchar *maps_key;
120         gchar *search_string;
121         gchar *categories;
122         gint num_res;
123         mapzen_boundary_s *boundary;
124 } mapzen_search_req_s;
125
126 typedef struct {
127         gchar *maps_key;
128         gchar *uri;
129 } mapzen_get_details_req_s;
130
131 typedef struct {
132         gchar *maps_key;
133         coords_s from;
134         coords_s to;
135         route_unit unit;
136         route_type type;
137         route_feature_avoids avoids;            /* List of type strings. (Limited Access, Toll Road, Ferry, Unpaved, Seasonal Closure, Country Crossing) */
138         route_driving_style driving_style;      /* (1 - cautious, 2 - normal, 3 - aggressive) */
139         GList *way_points;                              /* List of type coords_s */
140 } mapzen_route_req_s;
141
142 typedef struct {
143         gint zoom_level;
144         coords_s center_coords;
145 } mapzen_tiledata_req_s;
146
147 typedef struct {
148         gchar *street;
149         gchar *neighbourhood;
150         gchar *housenumber;
151         gchar *localadmin;
152         gchar *county;
153         gchar *region;
154         gchar *country;
155         gchar *country_a;
156         gchar *postalcode;
157 } mapzen_address_resp_s;
158
159 typedef struct {
160         gchar *place_id;
161         gchar *display_name;
162         mapzen_address_resp_s *address;
163         coords_s coordinates;
164         GList *categories;
165 } mapzen_place_resp_s;
166
167 typedef struct {
168         guint type;
169         guint direction;
170         guint text;
171         gchar *icon_url;
172 } mapzen_route_maneuver_signs;
173
174 typedef struct {
175         coords_s start_point;
176         coords_s end_point;
177         gdouble distance;
178         guint time;
179         guint type;
180         gchar *instruction;
181         gchar *street_name;
182 } mapzen_route_maneuver;
183
184 typedef struct {
185         coords_s origin;
186         coords_s destination;
187         rectangle_s bounding_box;
188         gdouble distance;
189         guint time;
190         GList *maneuvers;               /* List of type mapzen_route_maneuver */
191         GList *shapePoints;
192 } mapzen_route_segment;
193
194 typedef struct {
195         coords_s origin;
196         coords_s destination;
197         rectangle_s bounding_box;
198         gdouble distance;
199         route_unit distance_unit;
200         guint time;
201         route_type type;
202         GList *segments;                /* List of type mapzen_route_segment */
203         GList *shapePoints;
204         gchar *language;
205 } mapzen_route_resp_s;
206
207 #endif /* _MAPZEN_TYPES_H_ */