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 /*----------------------------------------------------------------------------*/
47 static volatile int command_request_id;
49 static command empty_instance;
52 : m(NULL), my_req_id(-1), error(0), is_merged(false)
54 } /* Please, do not construct an empty object */
56 command(maps_service_h ms);
57 command(const command &src);
59 command & operator=(const command &src);
64 static command *empty_ptr()
66 return &empty_instance;
69 plugin::interface_s *interface() const;
70 maps_plugin_h handle() const;
72 plugin::plugin_s *plugin()const;
74 virtual command_type_e get_type() const;
75 virtual int get_priority() const;
76 virtual void merge(const command *c);
83 /*----------------------------------------------------------------------------*/
88 plugin::plugin_s *plg;
94 command_handler(plugin::plugin_s *plugin, void *user_data,
96 virtual ~command_handler();
98 command_handler() : plg(NULL), user_data(NULL),
99 user_req_id(-1), plg_req_id(-1)
102 command_handler(const command_handler &src) : plg(NULL),
103 user_data(NULL), user_req_id(-1), plg_req_id(-1)
106 command_handler &operator=(const command_handler &src)
111 plugin::plugin_s *plugin()const
115 void set_supported_place_data(maps_place_h place);
116 void set_supported_route_data(maps_route_h route);
117 void set_supported_place_list_data(maps_place_list_h place_list);
118 static bool set_supported_place_list_data_cb(int index, maps_place_h place, void *user_data);
120 static void destroy(void *p);
123 /*----------------------------------------------------------------------------*/
125 class pending_request
128 plugin::plugin_s *plg;
130 pending_request(plugin::plugin_s *plugin);
131 virtual ~pending_request()
135 pending_request() : plg(NULL) {
137 pending_request(const pending_request &src)
140 pending_request &operator=(const pending_request &src)
145 bool add(const int user_req_id);
146 void update(int user_req_id, command_handler *handler);
147 void remove(int user_req_id);
148 command_handler *look_up(const int user_req_id);
149 int extract_plg_id(const int user_req_id);
150 bool contains(const int user_req_id);
152 int *int_dup(const int n);
156 #endif /* __MAPS_SERVICE_SESSION_COMMAND_H__ */