4 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7 * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
26 #include "location/location-log.h"
27 #include "location/location-ielement.h"
30 location_ielement_base_init (gpointer g_class)
32 static gboolean is_initialized = FALSE;
35 /* add properties and signals to the interface here */
37 is_initialized = TRUE;
42 location_ielement_get_type (void)
44 static GType iface_type = 0;
46 if (iface_type == 0) {
47 static const GTypeInfo info = {
48 sizeof (LocationIElementInterface),
49 location_ielement_base_init, /* base_init */
50 NULL /* base_finalize */
53 iface_type = g_type_register_static (G_TYPE_INTERFACE, "LocationIElement",
61 location_ielement_start (LocationIElement *self)
63 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
64 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->start, LOCATION_ERROR_NOT_AVAILABLE);
65 return LOCATION_IELEMENT_GET_INTERFACE (self)->start (self);
69 location_ielement_stop (LocationIElement *self)
71 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
72 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->stop, LOCATION_ERROR_NOT_AVAILABLE);
73 return LOCATION_IELEMENT_GET_INTERFACE (self)->stop (self);
77 location_ielement_get_position (LocationIElement *self,
78 LocationPosition **position,
79 LocationAccuracy **accuracy)
81 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
82 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
83 g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
84 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_position, LOCATION_ERROR_NOT_AVAILABLE);
86 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_position (self, position, accuracy);
90 location_ielement_get_velocity (LocationIElement *self,
91 LocationVelocity **velocity,
92 LocationAccuracy **accuracy)
94 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
95 g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
96 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_velocity, LOCATION_ERROR_NOT_AVAILABLE);
97 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_velocity (self, velocity, accuracy);
101 location_ielement_get_geocode (LocationIElement *self,
102 const LocationAddress *address,
103 GList **position_list,
104 GList **accuracy_list)
106 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
107 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
108 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode, LOCATION_ERROR_NOT_AVAILABLE);
110 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode (self, address, position_list, accuracy_list);
114 location_ielement_get_geocode_freeform (LocationIElement *self,
115 const gchar *address,
116 GList **position_list,
117 GList **accuracy_list)
119 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
120 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
121 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform, LOCATION_ERROR_NOT_AVAILABLE);
123 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform (self, address, position_list, accuracy_list);
127 location_ielement_get_reversegeocode (LocationIElement *self,
128 const LocationPosition *position,
129 LocationAddress **address,
130 LocationAccuracy **accuracy)
132 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
133 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
134 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
135 g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
136 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode, LOCATION_ERROR_NOT_AVAILABLE);
137 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode (self, position, address, accuracy);
141 location_ielement_get_geocode_async (LocationIElement *self,
142 const LocationAddress *address,
143 LocationPositionCB callback,
146 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
147 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
148 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
149 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
150 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_async (self, address, callback, userdata);
154 location_ielement_get_geocode_freeform_async (LocationIElement *self,
155 const gchar *address,
156 LocationPositionCB callback,
159 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
160 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
161 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
162 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async, LOCATION_ERROR_NOT_AVAILABLE);
163 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async (self, address, callback, userdata);
167 location_ielement_get_reversegeocode_async (LocationIElement *self,
168 const LocationPosition *position,
169 LocationAddressCB callback,
172 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
173 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
174 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
175 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async, LOCATION_ERROR_NOT_AVAILABLE);
176 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async (self, position, callback, userdata);
180 location_ielement_get_poi (LocationIElement *self,
182 const gchar* keyword,
183 LocationPOIInfo **poi_info)
185 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
186 g_return_val_if_fail (poi_info, LOCATION_ERROR_PARAMETER);
187 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi, LOCATION_ERROR_NOT_AVAILABLE);
188 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi(self, radius, keyword, poi_info);
192 location_ielement_get_poi_from_address (LocationIElement *self,
193 const LocationAddress* address,
195 const gchar *keyword,
196 LocationPOIInfo **poi_info)
198 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
199 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
200 g_return_val_if_fail (poi_info, LOCATION_ERROR_PARAMETER);
201 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_address, LOCATION_ERROR_NOT_AVAILABLE);
202 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_address(self, address, radius, keyword, poi_info);
206 location_ielement_get_poi_from_position (LocationIElement *self,
207 const LocationPosition *position,
209 const gchar *keyword,
210 LocationPOIInfo **poi_info)
212 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
213 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
214 g_return_val_if_fail (poi_info, LOCATION_ERROR_PARAMETER);
215 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_position, LOCATION_ERROR_NOT_AVAILABLE);
216 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_position(self, position, radius, keyword, poi_info);
220 location_ielement_get_poi_async (LocationIElement *self,
222 const gchar *keyword,
223 LocationPOICB callback,
226 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
227 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
228 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_async, LOCATION_ERROR_NOT_AVAILABLE);
229 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_async (self, radius, keyword, callback, userdata);
233 location_ielement_get_poi_from_address_async (LocationIElement *self,
234 const LocationAddress *address,
236 const gchar* keyword,
237 LocationPOICB callback,
240 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
241 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
242 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
243 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_address_async, LOCATION_ERROR_NOT_AVAILABLE);
244 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_address_async (self, address, radius, keyword, callback, userdata);
249 int location_ielement_get_poi_from_position_async (LocationIElement *self,
250 const LocationPosition* position,
252 const gchar* keyword,
253 LocationPOICB callback,
256 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
257 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
258 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
259 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_position_async, LOCATION_ERROR_NOT_AVAILABLE);
260 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_position_async (self, position, radius, keyword, callback, userdata);