bf3425b1e5fda0aa646c609318e47988bafd9609
[framework/location/maps-service.git] / src / session / commands.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 __MAPS_SERVICE_SESSION_COMMANDS_H__
18 #define __MAPS_SERVICE_SESSION_COMMANDS_H__
19
20 #include "command.h"
21
22 namespace session
23 {
24
25 /*----------------------------------------------------------------------------*/
26         /*typedef int (*maps_plugin_geocode_f)(maps_service_h maps,
27         * const char *address, maps_service_geocode_cb callback,
28         * void *user_data, int* request_id); */
29         class command_geocode : public command
30         {
31         public:
32                 const string address;
33                 maps_item_hashtable_h preference;
34                 maps_service_geocode_cb callback;
35                 void *user_data;
36                 int error;
37         public:
38                 command_geocode(maps_service_h ms,
39                                  const string address,
40                                  const maps_item_hashtable_h preference,
41                                  maps_service_geocode_cb callback,
42                                  void *user_data, int *request_id);
43                 virtual ~command_geocode();
44         private:
45                 command_geocode() : command(NULL)
46                 {
47                 }
48                 command_geocode(const command_geocode &src) : command(NULL)
49                 {
50                 }
51                 command_geocode &operator=(const command_geocode &src)
52                 {
53                         return *this;
54                 }
55         private:
56                 virtual int run();
57         };
58
59         class command_geocode_handler : public command_handler
60         {
61                 maps_service_geocode_cb callback;
62         public:
63                 command_geocode_handler(plugin::plugin_s *plugin,
64                                          maps_service_geocode_cb callback,
65                                          void *user_data,
66                                          int user_req_id);
67                  virtual ~command_geocode_handler()
68                 {
69                 };
70         private:
71                 command_geocode_handler() : command_handler(NULL, NULL, 0) {}
72                 command_geocode_handler(const command_geocode_handler &src) :
73                          command_handler(NULL, NULL, 0)
74                 {
75                 }
76                 command_geocode_handler &operator=(
77                         const command_geocode_handler &src)
78                 {
79                         return *this;
80                 }
81         private:
82                 static bool foreach_geocode_cb(maps_error_e result,
83                                                int request_id, int index,
84                                                int total_count,
85                                                maps_coordinates_h coordinates,
86                                                void *user_data);
87                 friend class command_geocode;
88                 friend class command_geocode_inside_bounds;
89                 friend class command_geocode_by_structured_address;
90         };
91
92 /*----------------------------------------------------------------------------*/
93
94         /* TODO: rename to command_geocode_inside_area */
95
96         /*typedef int (*maps_plugin_geocode_inside_area_f)(maps_service_h maps,
97         * const char *address, maps_area_h bounds,
98         * maps_service_geocode_cb callback, void *user_data,
99         * int* request_id); */
100         class command_geocode_inside_bounds : public command
101         {
102         public:
103                 string address;
104                 maps_area_h bounds;
105                 maps_item_hashtable_h preference;
106                 maps_service_geocode_cb callback;
107                 void *user_data;
108                 int error;
109         public:
110                 command_geocode_inside_bounds(maps_service_h ms,
111                                                const char *address,
112                                                const maps_area_h bounds,
113                                                const maps_item_hashtable_h
114                                                preference,
115                                                maps_service_geocode_cb callback,
116                                                void *user_data,
117                                                int *request_id);
118                 virtual ~command_geocode_inside_bounds();
119         private:
120                 command_geocode_inside_bounds() : command(NULL)
121                 {
122                 }
123                 command_geocode_inside_bounds(
124                         const command_geocode_inside_bounds &src)
125                          : command(NULL)
126                 {
127                 }
128                 command_geocode_inside_bounds &operator=(
129                         const command_geocode_inside_bounds &src)
130                 {
131                         return *this;
132                 }
133         private:
134                 virtual int run();
135         };
136
137 /*----------------------------------------------------------------------------*/
138         /*typedef int (*maps_plugin_geocode_by_structured_address_f)(
139         * maps_service_h maps, maps_address_h address,
140         * maps_preference_h preference, maps_service_geocode_cb callback,
141         * void *user_data, int *request_id); */
142         class command_geocode_by_structured_address : public command
143         {
144         public:
145                 maps_address_h address;
146                 maps_item_hashtable_h preference;
147                 maps_service_geocode_cb callback;
148                 void *user_data;
149                 int error;
150         public:
151                 command_geocode_by_structured_address(maps_service_h ms,
152                                                        const maps_address_h
153                                                        address,
154                                                        const
155                                                        maps_item_hashtable_h
156                                                        preference,
157                                                        maps_service_geocode_cb
158                                                        callback,
159                                                        void *user_data,
160                                                        int *request_id);
161                 virtual ~command_geocode_by_structured_address();
162         private:
163                 command_geocode_by_structured_address() : command(NULL)
164                 {
165                 }
166                 command_geocode_by_structured_address(
167                         const command_geocode_by_structured_address &src)
168                          : command(NULL)
169                 {
170                 }
171                 command_geocode_by_structured_address &operator=(
172                         const command_geocode_by_structured_address &src)
173                 {
174                         return *this;
175                 }
176         private:
177                 virtual int run();
178         };
179
180 /*----------------------------------------------------------------------------*/
181         /*typedef int (*maps_plugin_reverse_geocode_f)(maps_service_h maps,
182         * double latitude, double longitude,
183         * maps_service_reverse_geocode_cb callback, void *user_data,
184         * int *request_id); */
185         class command_reverse_geocode : public command
186         {
187         public:
188                 const string address;
189                 double latitude;
190                 double longitude;
191                 maps_item_hashtable_h preference;
192                 maps_service_reverse_geocode_cb callback;
193                 void *user_data;
194                 int error;
195         public:
196                 command_reverse_geocode(maps_service_h ms,
197                                          double latitude, double longitude,
198                                          const maps_item_hashtable_h preference,
199                                          maps_service_reverse_geocode_cb
200                                          callback,
201                                          void *user_data, int *request_id);
202                 virtual ~command_reverse_geocode();
203         private:
204                 command_reverse_geocode() : command(NULL)
205                 {
206                 }
207                 command_reverse_geocode(const command_reverse_geocode &src)
208                          : command(NULL)
209                 {
210                 }
211                 command_reverse_geocode& operator=(
212                         const command_reverse_geocode &src)
213                 {
214                         return *this;
215                 }
216         private:
217                 virtual int run();
218         };
219
220         class command_reverse_geocode_handler : public command_handler
221         {
222                 maps_service_reverse_geocode_cb callback;
223         public:
224                 command_reverse_geocode_handler(plugin::plugin_s *plugin,
225                                                  maps_service_reverse_geocode_cb
226                                                  callback,
227                                                  void *user_data,
228                                                  int user_req_id);
229                 virtual ~command_reverse_geocode_handler()
230                 {
231                 };
232         private:
233                 command_reverse_geocode_handler()
234                          : command_handler(NULL, NULL, 0)
235                 {
236                 }
237                 command_reverse_geocode_handler(
238                         command_reverse_geocode_handler &src)
239                          : command_handler(NULL, NULL, 0)
240                 {
241                 }
242                 command_reverse_geocode_handler &operator=(
243                         const command_reverse_geocode_handler &src)
244                 {
245                         return *this;
246                 }
247         private:
248                 static void foreach_reverse_geocode_cb(maps_error_e result,
249                                                        int request_id,
250                                                        int index, int total,
251                                                        maps_address_h address,
252                                                        void *user_data);
253                 friend class command_reverse_geocode;
254         };
255
256 /*----------------------------------------------------------------------------*/
257         /*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
258         * maps_coordinates_h position, int distance,
259         * maps_item_hashtable_h preference, maps_place_filter_h filter,
260         * maps_service_search_place_cb callback, void *user_data,
261         * int *request_id); */
262         class command_search_place : public command
263         {
264         public:
265                 maps_coordinates_h position;
266                 int distance;
267                 maps_item_hashtable_h preference;
268                 maps_place_filter_h filter;
269                 maps_service_search_place_cb callback;
270                 void *user_data;
271
272                 int error;
273         public:
274                 command_search_place(maps_service_h ms,
275                                       const maps_coordinates_h position,
276                                       int distance,
277                                       const maps_item_hashtable_h preference,
278                                       const maps_place_filter_h filter,
279                                       maps_service_search_place_cb callback,
280                                       void *user_data, int *request_id);
281                 virtual ~command_search_place();
282         private:
283                 command_search_place() : command(NULL)
284                 {
285                 }
286                 command_search_place(const command_search_place &src)
287                          : command(NULL)
288                 {
289                 }
290                 command_search_place &operator=(
291                         const command_search_place &src)
292                 {
293                         return *this;
294                 }
295         private:
296                 virtual int run();
297         };
298
299         class command_search_place_handler : public command_handler
300         {
301                 maps_service_search_place_cb callback;
302         public:
303                 command_search_place_handler(plugin::plugin_s *plugin,
304                                               maps_service_search_place_cb
305                                               callback,
306                                               void *user_data, int user_req_id);
307                 virtual ~command_search_place_handler()
308                 {
309                 };
310         private:
311                 command_search_place_handler()
312                          : command_handler(NULL, NULL, 0)
313                 {
314                 }
315                 command_search_place_handler(
316                         const command_search_place_handler &src)
317                          : command_handler(NULL, NULL, 0)
318                 {
319                 }
320                 command_search_place_handler &operator=(
321                         const command_search_place_handler &src)
322                 { return *this;
323                 }
324         private:
325                 static bool foreach_place_cb(maps_error_e error, int request_id,
326                                              int index, int length,
327                                              maps_place_h place,
328                                              void *user_data);
329                 void set_supported_data(maps_place_h place);
330                 friend class command_search_place;
331                 friend class command_search_by_area_place;
332                 friend class command_search_by_address_place;
333         };
334
335 /*----------------------------------------------------------------------------*/
336         /*typedef int (*maps_plugin_search_place_by_area_f)(maps_service_h maps,
337         * maps_area_h boundary , maps_item_hashtable_h preference,
338         * maps_place_filter_h filter, maps_service_search_place_cb callback,
339         * void *user_data, int *request_id); */
340         class command_search_by_area_place : public command
341         {
342         public:
343                 maps_area_h boundary;
344                 maps_item_hashtable_h preference;
345                 maps_place_filter_h filter;
346                 maps_service_search_place_cb callback;
347                 void *user_data;
348
349                 int error;
350         public:
351                 command_search_by_area_place(maps_service_h ms,
352                                               const maps_area_h boundary,
353                                               const maps_item_hashtable_h
354                                               preference,
355                                               const maps_place_filter_h filter,
356                                               maps_service_search_place_cb
357                                               callback,
358                                               void *user_data, int *request_id);
359                 virtual ~command_search_by_area_place();
360         private:
361                 command_search_by_area_place() : command(NULL)
362                 {
363                 }
364                 command_search_by_area_place(
365                         const command_search_by_area_place &src)
366                          : command(NULL)
367                 {
368                 }
369                 command_search_by_area_place &operator=(
370                         const command_search_by_area_place &src)
371                 {
372                         return *this;
373                 }
374         private:
375                 virtual int run();
376         };
377
378 /*----------------------------------------------------------------------------*/
379         /*typedef int (*maps_plugin_search_place_by_address_f)(
380         * maps_service_h maps, const char *address, maps_area_h boundary,
381         * maps_place_preference_h preference, maps_place_filter_h filter,
382         * maps_service_search_place_cb callback, void *user_data,
383         * int *request_id); */
384         class command_search_by_address_place : public command
385         {
386         public:
387                 const string address;
388                 maps_area_h boundary;
389                 maps_item_hashtable_h preference;
390                 maps_place_filter_h filter;
391                 maps_service_search_place_cb callback;
392                 void *user_data;
393
394                 int error;
395         public:
396                 command_search_by_address_place(maps_service_h ms,
397                         const char *address,
398                         const maps_area_h boundary,
399                         const maps_item_hashtable_h preference,
400                         const maps_place_filter_h filter,
401                         maps_service_search_place_cb callback,
402                         void *user_data, int *request_id);
403                 virtual ~command_search_by_address_place();
404         private:
405                 command_search_by_address_place() : command(NULL)
406                 {
407                 }
408                 command_search_by_address_place(
409                         const command_search_by_address_place &src)
410                          : command(NULL)
411                 {
412                 }
413                 command_search_by_address_place &operator=(
414                         const command_search_by_address_place &src)
415                 {
416                         return *this;
417                 }
418         private:
419                 virtual int run();
420         };
421
422 /*----------------------------------------------------------------------------*/
423         /*typedef int (*maps_plugin_search_route_f)(
424         * maps_service_h maps, maps_item_hashtable_h preference,
425         * maps_coordinates_h origin, maps_coordinates_h destination,
426         * maps_service_search_route_cb callback, void *user_data,
427         * int *request_id); */
428         class command_search_route_handler : public command_handler
429         {
430                 maps_service_search_route_cb callback;
431         public:
432                 command_search_route_handler(plugin::plugin_s *plugin,
433                                               maps_service_search_route_cb
434                                               callback,
435                                               void *user_data, int user_req_id);
436                 virtual ~command_search_route_handler()
437                 {
438                 };
439         private:
440                 command_search_route_handler()
441                          : command_handler(NULL, NULL, 0)
442                 {
443                 }
444                 command_search_route_handler(
445                         const command_search_route_handler &src)
446                          : command_handler(NULL, NULL, 0)
447                 {
448                 }
449                 command_search_route_handler &operator=(
450                         const command_search_route_handler &src)
451                 {
452                         return *this;
453                 }
454         private:
455                 static bool foreach_route_cb(maps_error_e error, int request_id,
456                                              int index, int length,
457                                              maps_route_h route,
458                                              void *user_data);
459                 void set_supported_data(maps_route_h route);
460                 friend class command_search_route;
461                 friend class command_search_route_waypoints;
462         };
463
464         class command_search_route : public command
465         {
466         public:
467                 maps_item_hashtable_h preference;
468                 maps_coordinates_h origin;
469                 maps_coordinates_h destination;
470                 maps_service_search_route_cb callback;
471                 void *user_data;
472
473                 int error;
474         public:
475                 command_search_route(maps_service_h ms,
476                                       const maps_item_hashtable_h preference,
477                                       const maps_coordinates_h origin,
478                                       const maps_coordinates_h destination,
479                                       maps_service_search_route_cb callback,
480                                       void *user_data, int *request_id);
481                 virtual ~command_search_route();
482         private:
483                 command_search_route() : command(NULL)
484                 {
485                 }
486                 command_search_route(
487                         const command_search_route &src)
488                          : command(NULL)
489                 {
490                 }
491                 command_search_route &operator=(
492                         const command_search_route &src)
493                 {
494                         return *this;
495                 }
496         private:
497                 virtual int run();
498         };
499
500 /*----------------------------------------------------------------------------*/
501         /*typedef int (*maps_plugin_search_route_f)(maps_service_h maps,
502         * maps_item_hashtable_h preference, maps_coordinates_h *waypoint_list,
503         * int waypoint_num, maps_service_search_route_cb callback,
504         * void *user_data, int *request_id); */
505         class command_search_route_waypoints:public command
506         {
507         public:
508                 maps_item_hashtable_h preference;
509                 maps_coordinates_h *waypoint_list;
510                 int waypoint_num;
511                 maps_service_search_route_cb callback;
512                 void *user_data;
513
514                 int error;
515         public:
516                 command_search_route_waypoints(maps_service_h ms,
517                                         const maps_item_hashtable_h preference,
518                                         const maps_coordinates_h *waypoint_list,
519                                         int waypoint_num,
520                                         maps_service_search_route_cb callback,
521                                         void *user_data, int *request_id);
522                 virtual ~command_search_route_waypoints();
523         private:
524                 command_search_route_waypoints() : command(NULL)
525                 {
526                 }
527                 command_search_route_waypoints(
528                         const command_search_route_waypoints &src)
529                          : command(NULL)
530                 {
531                 }
532                 command_search_route_waypoints &operator=(
533                         const command_search_route_waypoints &src)
534                 {
535                         return *this;
536                 }
537         private:
538                 virtual int run();
539         };
540
541 /*----------------------------------------------------------------------------*/
542         /*typedef int (*maps_plugin_cancel_request_f)(maps_service_h maps,
543         * int request_id); */
544         class command_cancel_request : public command
545         {
546         public:
547                 int request_id;
548         public:
549                 command_cancel_request(maps_service_h ms, int rid)
550                  : command(ms),
551                         request_id(rid)
552                 {
553                 }
554                 virtual ~command_cancel_request()
555                 {
556                 };
557         private:
558                 command_cancel_request() : command(NULL)
559                 {
560                 }
561                 command_cancel_request(const command_cancel_request &src)
562                         : command(NULL)
563                 {
564                 }
565                 command_cancel_request &operator=(
566                         const command_cancel_request &src)
567                 {
568                         return *this;
569                 }
570         private:
571                 virtual int run();
572         };
573 }
574
575 #endif                          /* __MAPS_SERVICE_SESSION_COMMANDS_H__ */