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 main (int argc, char *argv[])
28 LocationObject *loc = NULL;
30 // If application is executed by AUL, this is not needed.
31 g_setenv("PKG_NAME", "com.samsung.cps-test", 1);
35 loc = location_new (LOCATION_METHOD_CPS);
37 g_debug("location_new failed");
41 LocationMethod method = LOCATION_METHOD_NONE;
42 g_object_get(loc, "method", &method, NULL);
43 g_debug("Get property>> method:%d", method);
45 LocationAccuracy *acc = NULL;
46 LocationPosition *pos = NULL;
47 LocationAddress *addr = NULL;
49 if (LOCATION_ERROR_NONE == location_get_position (loc, &pos, &acc)) {
50 g_debug ("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
51 pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
52 g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
53 acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
54 location_position_free(pos);
55 location_accuracy_free(acc);
56 } else g_warning ("SYNC>> Current position> failed");
57 if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
58 g_debug ("SYNC>> Current address> %s %s %s %s %s %s %s",
59 addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
60 g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
61 location_address_free(addr);
62 location_accuracy_free(acc);
63 } else g_warning ("SYNC>> Current address> failed");
65 g_object_get(loc, "last-position", &pos, NULL);
67 g_debug ("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
68 pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
69 location_position_free(pos);
70 } else g_warning("failed to get property> last-position");