2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __MAPS_SERVICE_SESSION_COMMAND_H__
18 #define __MAPS_SERVICE_SESSION_COMMAND_H__
20 #include "maps_plugin.h"
25 typedef enum _command_type_e {
27 MAPS_VIEW_SET_CENTER_COMMAND,
28 MAPS_VIEW_MOVE_CENTER_COMMAND,
29 MAPS_VIEW_ZOOM_COMMAND,
30 MAPS_VIEW_ROTATE_COMMAND,
31 MAPS_VIEW_ZOOM_ROTATE_COMMAND,
32 MAPS_VIEW_READY_COMMAND,
33 MAPS_UNDEF_COOMAND = -1
36 /*----------------------------------------------------------------------------*/
48 static volatile int command_request_id;
50 static command empty_instance;
53 : m(NULL), my_req_id(-1), error(0), is_merged(false)
55 } /* Please, do not construct an empty object */
57 command(maps_service_h ms);
58 command(const command &src);
60 command & operator=(const command &src);
65 static command *empty_ptr()
67 return &empty_instance;
70 plugin::interface_s *interface() const;
71 maps_plugin_h handle() const;
73 plugin::plugin_s *plugin()const;
75 virtual command_type_e get_type() const;
76 virtual int get_priority() const;
77 virtual void merge(const command *c);
84 /*----------------------------------------------------------------------------*/
89 plugin::plugin_s *plg;
95 command_handler(plugin::plugin_s *plugin, void *user_data,
97 virtual ~command_handler();
99 command_handler() : plg(NULL), user_data(NULL),
100 user_req_id(-1), plg_req_id(-1)
103 command_handler(const command_handler &src) : plg(NULL),
104 user_data(NULL), user_req_id(-1), plg_req_id(-1)
107 command_handler &operator=(const command_handler &src)
112 plugin::plugin_s *plugin()const
116 void set_supported_place_data(maps_place_h place);
117 void set_supported_route_data(maps_route_h route);
118 void set_supported_place_list_data(maps_place_list_h place_list);
119 static bool set_supported_place_list_data_cb(int index, maps_place_h place, void *user_data);
121 static void destroy(void *p);
124 /*----------------------------------------------------------------------------*/
126 class pending_request
129 plugin::plugin_s *plg;
131 pending_request(plugin::plugin_s *plugin);
132 virtual ~pending_request()
136 pending_request() : plg(NULL) {
138 pending_request(const pending_request &src)
141 pending_request &operator=(const pending_request &src)
146 bool add(const int user_req_id);
147 void update(int user_req_id, command_handler *handler);
148 void remove(int user_req_id);
149 command_handler *look_up(const int user_req_id);
150 int extract_plg_id(const int user_req_id);
151 bool contains(const int user_req_id);
153 int *int_dup(const int n);
158 #endif /* __MAPS_SERVICE_SESSION_COMMAND_H__ */