2 * Copyright (c) 2011-2013 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.
25 static void get_addr_cb(geocoder_error_e result, const char *building_number, const char *postal_code, const char *street, const char *city, const char *district, const char *state, const char *country_code, void *user_data)
27 printf("get_addr_cb() ===> building number: %s, postal code: %s, street: %s, city: %s, district: %s, state: %s, country code: %s\n", building_number,postal_code,street,city,district,state,country_code);
30 static bool get_pos_cb(geocoder_error_e result, double latitude, double longitude, void *user_data)
32 printf ("get_pos_cb() ===> latitude : %g, longitude : %g\n",latitude, longitude);
41 ret = geocoder_create(&geocoder);
42 if(ret != GEOCODER_ERROR_NONE)
44 printf ("geocoder_create return error : %d=n", ret);
48 ret = geocoder_get_address_from_position(geocoder,37.258,127.056,get_addr_cb, NULL);
49 if(ret != GEOCODER_ERROR_NONE)
51 printf ("geocoder_get_address_from_position return error : %d\n", ret);
56 int reverse_geocoder_test()
61 ret = geocoder_create(&geocoder);
62 if(ret != GEOCODER_ERROR_NONE)
64 printf ("geocoder_create return error : %d=n", ret);
67 char *address="suwon";
69 ret = geocoder_foreach_positions_from_address (geocoder,address, get_pos_cb, (void*)geocoder);
70 if(ret != GEOCODER_ERROR_NONE)
72 printf ("geocoder_foreach_positions_from_address_sync return error : %d\n", ret);
78 static GMainLoop *loop = NULL;
80 static gboolean exit_program (gpointer data)
82 g_main_loop_quit (loop);
83 printf("Quit g_main_loop\n");
88 int main(int argc, char ** argv)
90 loop =g_main_loop_new (NULL, TRUE);
91 g_setenv("PKG_NAME", "org.tizen.capi-location-geocoder-test", 1);
94 reverse_geocoder_test();
95 g_timeout_add_seconds(30, exit_program, NULL);
96 g_main_loop_run (loop);