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 LocationPosition **position,
104 LocationAccuracy **accuracy)
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 (position, LOCATION_ERROR_PARAMETER);
109 g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
110 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode, LOCATION_ERROR_NOT_AVAILABLE);
111 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode (self, address, position, accuracy);
115 location_ielement_get_geocode_freeform (LocationIElement *self,
116 const gchar *address,
117 LocationPosition **position,
118 LocationAccuracy **accuracy)
120 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
121 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
122 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
123 g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
124 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform, LOCATION_ERROR_NOT_AVAILABLE);
125 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform (self, address, position, accuracy);
129 location_ielement_get_reversegeocode (LocationIElement *self,
130 const LocationPosition *position,
131 LocationAddress **address,
132 LocationAccuracy **accuracy)
134 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
135 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
136 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
137 g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
138 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode, LOCATION_ERROR_NOT_AVAILABLE);
139 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode (self, position, address, accuracy);
143 location_ielement_get_geocode_async (LocationIElement *self,
144 const LocationAddress *address,
145 LocationPositionCB callback,
148 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
149 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
150 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
151 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
152 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_async (self, address, callback, userdata);
156 location_ielement_get_geocode_freeform_async (LocationIElement *self,
157 const gchar *address,
158 LocationPositionCB callback,
161 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
162 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
163 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
164 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async, LOCATION_ERROR_NOT_AVAILABLE);
165 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async (self, address, callback, userdata);
169 location_ielement_get_reversegeocode_async (LocationIElement *self,
170 const LocationPosition *position,
171 LocationAddressCB callback,
174 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
175 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
176 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
177 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async, LOCATION_ERROR_NOT_AVAILABLE);
178 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async (self, position, callback, userdata);
182 location_ielement_get_poi (LocationIElement *self,
184 const gchar* keyword,
185 LocationPOIInfo **poi_info)
187 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
188 g_return_val_if_fail (poi_info, LOCATION_ERROR_PARAMETER);
189 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi, LOCATION_ERROR_NOT_AVAILABLE);
190 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi(self, radius, keyword, poi_info);
194 location_ielement_get_poi_from_address (LocationIElement *self,
195 const LocationAddress* address,
197 const gchar *keyword,
198 LocationPOIInfo **poi_info)
200 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
201 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
202 g_return_val_if_fail (poi_info, LOCATION_ERROR_PARAMETER);
203 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_address, LOCATION_ERROR_NOT_AVAILABLE);
204 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_address(self, address, radius, keyword, poi_info);
208 location_ielement_get_poi_from_position (LocationIElement *self,
209 const LocationPosition *position,
211 const gchar *keyword,
212 LocationPOIInfo **poi_info)
214 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
215 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
216 g_return_val_if_fail (poi_info, LOCATION_ERROR_PARAMETER);
217 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_position, LOCATION_ERROR_NOT_AVAILABLE);
218 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_position(self, position, radius, keyword, poi_info);
222 location_ielement_get_poi_async (LocationIElement *self,
224 const gchar *keyword,
225 LocationPOICB callback,
228 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
229 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
230 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_async, LOCATION_ERROR_NOT_AVAILABLE);
231 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_async (self, radius, keyword, callback, userdata);
235 location_ielement_get_poi_from_address_async (LocationIElement *self,
236 const LocationAddress *address,
238 const gchar* keyword,
239 LocationPOICB callback,
242 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
243 g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
244 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
245 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_address_async, LOCATION_ERROR_NOT_AVAILABLE);
246 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_address_async (self, address, radius, keyword, callback, userdata);
251 int location_ielement_get_poi_from_position_async (LocationIElement *self,
252 const LocationPosition* position,
254 const gchar* keyword,
255 LocationPOICB callback,
258 g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
259 g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
260 g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
261 g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_position_async, LOCATION_ERROR_NOT_AVAILABLE);
262 return LOCATION_IELEMENT_GET_INTERFACE (self)->get_poi_from_position_async (self, position, radius, keyword, callback, userdata);